what will be printed by this printf?
printf("%c",printf("hi")["sharkselva"]));
}
Answer Posted / vadivelt
Ans: hia
Reason is, in the below statement,
printf("%c",printf("hi")["sharkselva"]));
printf("hi") shall be executed first. and this printf will
return the value 2. ie., no of characters successfully
printed by printf()statement.
So in runtime, "printf("%c",printf("hi")["sharkselva"]));"
will print "hi" and after, the main printf shall be
replaced as "printf("%c",2["sharkselva"]));".
According to printf() implementation, printf("%c",2
["sharkselva"]));" has to print the value at the array, for
the index given ie., 2. So in the array index '2',
character 'a' is available.
Now a is printed.
So the total output will be -> hia
Is This Answer Correct ? | 31 Yes | 1 No |
Post New Answer View All Answers
What is structure in c definition?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
Is multithreading possible in c?
Is c easy to learn?
Explain what are linked list?
How will you write a code for accessing the length of an array without assigning it to another variable?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
The __________ attribute is used to announce variables based on definitions of columns in a table?
Are the expressions * ptr ++ and ++ * ptr same?
differentiate built-in functions and user – defined functions.
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
What is a null string in c?
what is the syallabus of computer science students in group- 1?
What is the difference between memcpy and memmove?