this c programming has been giving me lot of grief...
why is
char x[10];
scanf("%s", x);
printf("%s", x);
this works?
BUT
int n ;
scanf("%i", n);
printf("%i", n);
this doesnt work, unless you change
scanf("%i", &n);
Is it because char is an array? But shouldnt pointers only be used when there is an array? actually when should you use a pointer?
Also if you want to use string in c, you have to do like char *string, so all strings are secretly arrays?
Also why is
char *s = "xyz";
printf("%s", s);
this is OK
but
printf("%s", s[1]);
This is NOT ok
and instead need to put the & like this to work
printf("%s", &s[1]);
??
need help with c programming