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
What is the last index number in an array of 100 characters a) 100 b) 99 c) 101
What is difference between rand () and srand ()?
What is set in c++?
what you know about c++?
What is recursion?
What is the basic concept of c++?
How can I learn c++ easily?
What is size of string in c++?
What apps are written in c++?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
What is the identity function in c++? How is it useful?
What does asterisk mean in c++?
What is the history of c++?
How would you use the functions randomize() and random()?
What is difference between malloc()/free() and new/delete?