Created
January 10, 2017 16:01
-
-
Save spoorcc/c168d96eeac9442924cfa6ec8ac1858b to your computer and use it in GitHub Desktop.
Build error string
This file contains 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> | |
struct my_string_t { | |
uint8_t len; | |
// char string[]; | |
// const char string[]; | |
char string[128]; | |
// const char * const string; | |
}; | |
#define STRING(_string) {.len=sizeof(_string), .string=(_string)} | |
int main(void) | |
{ | |
struct my_string_t my_string_list[] = {STRING("Hello")}; | |
fprintf(stderr, "%s\n", my_string_list[0].string); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When compiled with
char string[]
following build error: