#include <stdio.h>
char str[]="astro\0nave";
void main() {
int i;
for(i=0; str[i] !='\0'; i++) {
printf("str[%d] = %c\n", i, str[i]);
}
printf("%s\n", str); //se scrivo str[i] devo usare la diretiva di formattazione dei caratteri %c perchè non
//sto scrivendo una stringa, se invece devo scrivere tutta la stringa uso %s
//e scrivo solo str senza le parentesi quadre
}
To embed this project on your website, copy the following code and paste it into your website's HTML: