fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void)
  5. {
  6. typedef char cstring[100]; //cstring is a new type which is
  7. //a char array of size 100
  8.  
  9. cstring *arrstring = malloc (10* sizeof (cstring)); //19 strings, for demo!
  10.  
  11. int i;
  12. for( i = 0 ; i < 10; ++i)
  13. strcpy(arrstring[i], "some string of size less than or equal to 100");
  14.  
  15. for( i = 0 ; i < 10; ++i)
  16. printf("%s\n", arrstring[i]);
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 1852KB
stdin
Standard input is empty
stdout
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100
some string of size less than or equal to 100