stringtest.c 663 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. Sample tester code to feed the other utils.
  3. Free Software as licensed through the GNU GPL v3
  4. */
  5. #include <stdio.h>
  6. #include <string.h>
  7. #define ROSTER_LIMIT 3
  8. int main(int argc, char* argv[])
  9. {
  10. char* roster[ROSTER_LIMIT];
  11. char dest[15] = "hattie ";
  12. char* two = "cat";
  13. strcat(dest, two);
  14. printf("The string is %s\n", dest);
  15. for (int i = 0; i < ROSTER_LIMIT; i++) {
  16. char buffer[10] = "";
  17. strcat(buffer, "banana");
  18. roster[i] = buffer;
  19. }
  20. printf("The roster's members are:\n");
  21. for (int i = 0; i < ROSTER_LIMIT; i++) {
  22. printf(" - %s (%d)\n", roster[i], (i+1));
  23. }
  24. return 0;
  25. }