Last active
September 15, 2016 20:55
-
-
Save msikma/e0fda7e0d932e8b6433f098622dc0016 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char a[] = "foo\n"; | |
char b[] = "bar\n"; | |
char *c[] = { | |
a, | |
b | |
}; | |
// prints: "foo\n" as expected, no compile warnings | |
//int main() { | |
// printf("%s", c[0]); | |
//}; | |
// doesn't work | |
char *d = c[0]; | |
int main() { | |
printf("%s", d); | |
} | |
// test.c:16:11: error: initializer element is not a compile-time constant | |
// char *d = c[0]; | |
// ^~~~ | |
// 1 error generated. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment