Hello,
I would like to know where is my mistake on that program I made :
Code:
#include <stdio.h>
int main (int argc, char*argv[]) {
if (argc > 1) {
printf ("there are %d elements",argc);
printf ("the first element is %c",argv[1]);}
else
if {printf("there is one element");}
FILE*f1;
f1 = fopen(argv[1], "w");
fprintf(f1,"%c",argv[2]);
fclose(f1);
return 0;}
when I try to compile it it says :
Code:
test.c:7:3: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat]
test.c:12:1: warning: format ‘%c’ expects argument of type ‘int’, but argument 3 has type ‘char *’ [-Wformat]