F
futhark77
Hi,
In a program, I can declare strings that way:
char *some_str = "some string";
char *some_str2 = "some other string";
I will be able to work on them very naturally with strlen and such.
I thought I could also do the following:
char *str_table[] = {
"some string",
"some other string"
};
But then, I realized that each declared string is not terminated! In
other words, the result of printf ("%s", str_table[0]) is:
some stringsome other string
Can anyone explain why both aren't equivalent?
Thanks!
In a program, I can declare strings that way:
char *some_str = "some string";
char *some_str2 = "some other string";
I will be able to work on them very naturally with strlen and such.
I thought I could also do the following:
char *str_table[] = {
"some string",
"some other string"
};
But then, I realized that each declared string is not terminated! In
other words, the result of printf ("%s", str_table[0]) is:
some stringsome other string
Can anyone explain why both aren't equivalent?
Thanks!