main()
{
printf(5+"good morning");
printf("%c","abcdefgh"[4]);
}the o/p is morning and e...how someone explain



main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }th..

Answer / vignesh1988i

the o/p depends upon the compiler and cant be predicted
wat's hapenning inside .... each will have different
opinion.....my opinion is :
here in the first printf statement "good morning" acts as
an string and 5+"good morning" means print the string
after the 5th character in the string starting from 0....
so o/p is :
morning

for second one :

this printf can be re-written as the first printf statement
printf("%c",4+"abcdefgh");
here only the 4th character will get printed ... in this
case it will print 'e'..

thank u

Is This Answer Correct ?    26 Yes 11 No

Post New Answer

More C Interview Questions

What does the && operator do in a program code?

0 Answers  


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

0 Answers   XYZ,


How can I swap two values without using a temporary?

0 Answers  


Explain what standard functions are available to manipulate strings?

0 Answers  


Which header file is essential for using strcmp function?

0 Answers  






Which node is more powerful and can handle local information processing or graphics processing?

0 Answers  


What is pointer and structure in c?

0 Answers  


Explain what are bus errors, memory faults, and core dumps?

0 Answers  


Can the curly brackets { } be used to enclose a single line of code?

0 Answers  


Describe wild pointers in c?

0 Answers  


write a program to sort the elements in a given array in c language

10 Answers   TCS,


Is linux written in c?

0 Answers  


Categories