One of my friends sent me this code today:
#include <stdio.h>
int main()
{
char *s = { "one", "two", "three", "four", "five" };
puts(s);
}
Its output is:
one
As I know, strings like "one"
are translated as addresses in C, which are constants. Thus, "one", "two", "three", "four", "five"
is equal to "five"
due to comma operators among them. So shouldn't { "one", "two", "three", "four", "five" }
be equal to { "five" }
,creating char *s="five"
?