If the user enters a string, I want to store it, like if I want to store someone's name, how can I do that?
I tried to write a program but I am having some warnings. What might be the correct way to store string?
warning: format '%c' expects argument of type 'int', but argument 2 has type 'char *' [-Wformat=]Code:#include<stdio.h>
int main(void)
{
int i, size;
char string [size];
printf("Enter Size of string \n");
scanf("%d",&size);
printf(" Size of string : %d \n", size);
for (int i = 0; i < size; i++)
{
scanf ("%c", &string[i]);
printf ("%c", &string[i]);
}
return 0;
}
printf ("%c", &string[i]);
^
warning: unused variable 'i' [-Wunused-variable]
int i, size;