+ 1
Program of strings is compiling error,would you help me?
#include<stdio.h> int main() { int str[]={'g','l','o','b','y'}; printf("A%c ",str); printf("A%s ",str); printf("A%c ",str[0]); return 0; }
8 Antworten
+ 1
Yaa ok
0
It's a great deal to get compile, but it is solved in recent code exams I have done
0
But without any changes in the program,the answer is mentioned , as A character A Ag i guess not sure
0
The question is the same I have mentioned , and based exam I have attended to the correct answer is something like A character A ag, but when I am running it I am not getting the program compiled.
0
Ok
0
I guess, it is may be
printf("%Ac", *str) ;
%s not works on integer array.. So it may be charecter array...
0
%s is address of the int/string storing name
0
As far i know, %s returns charecter array or string in c.
Do you want to know the program by removing errors? It need atleast 2 changes to work without any warning.. Otherwise it prints A Ag Ag with warnings...
(If *str, then it returns g)
Edit :
Here this, With good examples:
https://aticleworld.com/format-specifiers-in-c/