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

What does std mean in c++?

1128


Explain method of creating object in C++ ?

1107


Explain selection sorting. Also write an example.

1051


How do I download c++?

1007


What is the disadvantage of using a macro?

1127


Will a recursive function without an end condition every quit, in practice a) Compiler-Specific (Some can convert to an infinite loop) b) No c) Yes

1080


How do c++ struct differs from the c++ class?

1201


What is the most common mistake on c++ and oo projects?

982


Explain what are accessor methods?

1125


What you know about structures in C++?

1082


Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.

1121


What is endianness?

1101


What are the extraction and insertion operators in c++? Explain with examples.

1197


What are the uses of c++ in the real world?

1039


How are the features of c++ different from c?

1102