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

Write a program to print factorial of given number using recursion?

964


Write a program to reverse a given number in c?

987


Is fortran faster than c?

987


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1927


What is c value paradox explain?

1023


What is cohesion in c?

925


What is the significance of an algorithm to C programming?

1001


Why static is used in c?

1035


write a c program in such a way that if we enter the today date the output should be next day's date.

2140


Ow can I insert or delete a line (or record) in the middle of a file?

957


Can a pointer point to null?

1027


What are near, far and huge pointers?

1016


Is c a great language, or what?

1052


How can I remove the trailing spaces from a string?

1028


What are data types in c language?

1016