what will be printed by this printf?
printf("%c",printf("hi")["sharkselva"]));
}

Answers were Sorted based on User's Feedback



what will be printed by this printf? printf("%c",printf("hi")["sharkselva&..

Answer / 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

what will be printed by this printf? printf("%c",printf("hi")["sharkselva&..

Answer / ramesh choudhury

hia

Is This Answer Correct ?    9 Yes 1 No

what will be printed by this printf? printf("%c",printf("hi")["sharkselva&..

Answer / srsabariselvan3

hia

Is This Answer Correct ?    9 Yes 2 No

Post New Answer

More C Interview Questions

What is structure padding & expalain wid example what is bit wise structure?

1 Answers  


What are the advantages of the functions?

0 Answers  


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

0 Answers  


What does the message "warning: macro replacement within a string literal" mean?

1 Answers  


Explain the use of fflush() function?

0 Answers  






What is the OOPs concept?

3 Answers  


What are pointers really good for, anyway?

0 Answers  


if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.

18 Answers   Parexel, Ram Infotech, Zycus Infotech,


What are global variables and explain how do you declare them?

0 Answers  


Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.

0 Answers  


how to write a program which adds two numbers without using semicolon in c

2 Answers  


can we store values and addresses in the same array? explain

3 Answers   TCS,


Categories