#include<stdio.h>
int main()
{
char str[3][10]={
"vipul",
"ss",
"shreya"
};
Why this won't work:
printf("%s",str[1][0]);
If i want to access str
whereas
printf("%s",&str[1][0]);
or this would do it perfectly
printf("%s",str[1]);
Can anyone explain ? Why is the first code giving an error
prog.c: In function ‘main’:
prog.c:9:5: error: format ‘%s’ expects argument of type ‘char *’, but
argument 2 has type ‘int’ [- Werror=format]
cc1: all warnings being treated as errors
Why does the argument has type int
?