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 is the output of printf("%d")?

Answer Posted / arvind kumar yadav

When we use %d the compiler internally uses it to access
the argument in the stack (argument stack). Ideally
compiler determines the offset of the data variable
depending on the format specification string. Now when we
write printf("%d",a) then compiler first accesses the top
most element in the argument stack of the printf which is %
d and depending on the format string it calculated to
offset to the actual data variable in the memory which is
to be printed. Now when only %d will be present in the
printf then compiler will calculate the correct offset
(which will be the offset to access the integer variable)
but as the actual data object is to be printed is not
present at that memory location so it will print what ever
will be the contents of that memory location.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How much do coding jobs pay?

1058


Which bit wise operator is suitable for putting on a particular bit in a number?

1259


What is a v-table?

1228


What is the difference between global int and static int declaration?

1149


How do we implement inheritance in c++?

1176


Tell me an example where stacks are useful?

1097


Is c++ a float?

1107


Explain unexpected() function?

1160


What is the output of the following program? Why?

1197


How can you quickly find the number of elements stored in a static array?

1137


What is the importance of mutable keyword?

1072


How do you find out if a linked-list has an end?

1175


What are the rules for naming an identifier?

1121


Can class objects be passed as function arguments?

1112


Is it possible for a member function to delete the pointer, named this?

1240