Possible Duplicate:
How to create an array of string in C?
In my Last question I wrote the following lines of code
#include <stdio.h>
int main(void){
char str1[] = {'f','i'};
char str2[] = {'s','e'};
char str3[] = {'t','h'};
char *arry_of_string[] = {str1,str2,str3};
printf("%s\n",arry_of_string[1]);
}
thanks to people points out I should at the '\0' at the end of the string. I learned the right way to do this. I'm curious about result of the faulty code:
sefi
I remember from the C reference book, pointer looking for the '\0' I think without the \0
terminator, it the result should be:
seth
because str3 is the next element in the array. Anyone can explain why is it in term of the internal structure of array?