Guest User

Untitled

a guest
Jan 27th, 2022
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. ````
  2. static const char *season[] = {
  3. [0] = "Winter",
  4. [1] = "Spring",
  5. [2] = "Summer",
  6. [3] = "Fall",
  7. };
  8.  
  9. struct WTF {
  10. const char *season;
  11. };
  12.  
  13. static const struct WTF wtf = { .season = season[2] };
  14. ````
  15.  
  16. mattst88@framework ~ % gcc -c t.c -o t.o
  17. t.c:12:43: error: initializer element is not constant
  18. 12 | static const struct WTF wtf = { .season = season[2] };
  19. | ^~~~~~
  20. t.c:12:43: note: (near initialization for ‘wtf.season’)
  21.  
Add Comment
Please, Sign In to add comment