B
blackneos940
Guest
I'm back..... Despite recent events, I still Love Programming.....
I, well....... I started making "Code Katas", based on an idea someone had, I believe..... It's where I practice, well, Coding.....
But, in a C Code Kata, I seem to have run into a problem.....
When I compile this
It throws these errors:
Datatypes.c: In function ‘main’:
Datatypes.c:16:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
scanf ("%s", &x);
^
Datatypes.c:20:10: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[20]’ [-Wformat=]
scanf ("%c", &z);
^
Datatypes.c:22:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
printf ("%s", x);
^
Datatypes.c:26:11: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]
printf ("%c", z);
I wonder what it could all mean.....?
Thanks for any help guys.......
And someday, I'm gonna start a Project..... It will be in Memory of my Dad....
You BET it'll be Open Source.......




Code:
#include <stdio.h>
#include <string.h>
#define TEST "62.4"
int main(void)
{
int x;
float y;
char z[20];
scanf ("%s", &x);
scanf ("%f", &y);
scanf ("%c", &z);
printf ("%s", x);
printf ("%f", y);
printf ("%c", z);
return 0;
}
It throws these errors:
Datatypes.c: In function ‘main’:
Datatypes.c:16:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
scanf ("%s", &x);
^
Datatypes.c:20:10: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[20]’ [-Wformat=]
scanf ("%c", &z);
^
Datatypes.c:22:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
printf ("%s", x);
^
Datatypes.c:26:11: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]
printf ("%c", z);
I wonder what it could all mean.....?




