How come that a pointer can freely be used as an array? I thought pointers are more powerful and important in memory manipulation? Can somebody explain to me in which scenario do pointers become more important?
Here is my code:
char * myString ="This is my String";
while(*myString){
putchar(*myString++);
}
puts("\n");
char * myString1 ="This is my String";
int j=0;
while(myString1[j]!='\0'){
putchar(myString1[j++]);
}
They print the same results.
Aucun commentaire:
Enregistrer un commentaire