Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you determine the maximum value that a numeric variable can hold?

1301


What does != Mean in c?

1096


Write a c program to demonstrate character and string constants?

2249


What are the key features in c programming language?

1128


What is a good data structure to use for storing lines of text?

1142


Explain how do you use a pointer to a function?

1163


Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.

1402


What is a constant?

1113


How can I copy just a portion of a string?

1370


Explain logical errors? Compare with syntax errors.

1129


How can you pass an array to a function by value?

1182


Is c# a good language?

1062


Differentiate between new and malloc(), delete and free() ?

1241


Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

1182


What is null in c?

1160