I'm getting the below warning on a C program. It does run. However, how do I fix the warning?
warning: format specifies type 'char *' but the argument has type 'char (*)[100]' [-Wformat]
printf("%s\n", &buf);
The code looks like this:
FILE *fp = fopen(filename, "r");
int len = 0;
char buf[100];
printf("\n sorting \n");
while (fscanf(fp, "%s", buf) != EOF)
{
printf("%s\n", &buf);
len++;
}
printf("Sorted\n");