Question: In C, I am writing a program which take a string as input, and then put it into an character array. I have code like

In C, I am writing a program which take a string as input, and then put it into an character array.

I have code like this.

char guess[20];

scanf("%s",&guess);

The code works fine but it keep give me a warning,

/autograder/submission/moo.c:111:12: error: format %s expects argument of type char *, but argument 2 has type char (*)[20] [-Werror=format=] scanf("%s",&guess);} 

I sort of understand what it says but have no idea how to fix it...

please help! thanks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!