I am reading C for Dummies and am doing a example in the book. It told me to write it out line by line. Then it proceeds through the book even though the code has bugs. Here it is:
#include <stdio.h>
int main()
{
char me[20];
printf("What is your name?");
scanf("%s",&me);
printf("Darn glad to meet you. %s!\n".me);
return(0);
}
According to gcc:
WHORU.C: In function ‘int main()’: WHORU.C:8:19: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[20]’ [-Wformat] WHORU.C:9:43: error: request for member ‘me’ in ‘"Darn glad to meet you. %s!\012"’, which is of non-class type ‘const char [28]’
Because I am new to C, I can't really point out where I did wrong. I do know that this code requires input when it's executed. It's kinda like scanner in java.
Thanks guys.