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...

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


Please Help Members By Posting Answers For Below Questions

How can you restore a redirected standard stream?

1066


What is anagram in c?

883


What is the value of c?

1022


can we have joblib in a proc ?

2243


Explain the array representation of a binary tree in C.

1177


How to compare array with pointer in c?

1064


Explain enumerated types in c language?

1000


Do you know pointer in c?

1002


Describe the difference between = and == symbols in c programming?

1310


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1967


What are register variables in c?

985


all c language question

2392


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

1065


Explain why c is faster than c++?

1014


What is #include cctype?

1084