#include <stdio.h>
#include <stdlib.h>
//#include <wchar.h>
int main(int argc, char **argv)
{
     char *c = (char *)malloc(sizeof(char) * 30);
     if (argc < 2)
     {      
         fprintf(stderr, "%s", "argc < 2\n");
         exit(1);
     }
     sprintf(c, "sprintf() string : %s\t argc: %i", argv[1], argc);
     fprintf(stdout, "%s\n", c);
     fprintf(stdout, "%s", "Done!\n");
     free(c);
     return 0;
}
I have compiled this program on two compilers, and both produce the same run-time error. However I can't pin down this error. Did I format the string correctly in sprintf()? Is there something I forgot to account for?
I run this program with an argument of argv[1] = "Sunday"
 
     
     
    