Skip to content

Instantly share code, notes, and snippets.

@msikma
Last active September 15, 2016 20:55
Show Gist options
  • Save msikma/e0fda7e0d932e8b6433f098622dc0016 to your computer and use it in GitHub Desktop.
Save msikma/e0fda7e0d932e8b6433f098622dc0016 to your computer and use it in GitHub Desktop.
#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