Advertisement
GeneralGuy4872

arrayofstrings

Nov 22nd, 2019
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. const char * foo = "Have\n";
  5. const char * bar = "A\n";
  6. const char * qux = "Nice\n";
  7. const char * zot = "Day!\n";
  8. char *xyzzy[] = calloc(5,sizeof(void*));
  9. notaconst__xyzzy () {
  10. xyzzy[0] = foo;
  11. xyzzy[1] = bar;
  12. xyzzy[2] = qux;
  13. xyzzy[3] = zot;
  14. }
  15.  
  16. notaconst__main () {
  17. notaconst__xyzzy();
  18. }
  19.  
  20. main () {
  21. notaconst__main();
  22. for (int n = 0;xyzzy[n] != NULL;n++) {
  23. printf("%s",xyzzy[n]);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement