What is the output of printf("%d")?
1. When we write printf("%d",x); this means compiler
will print the value of x. But as here, there is
after "%d", so compiler will show in output window
2. 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 calculte the correct offset (which will be the offset to access the integer varible) but as the actual data objet 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.
3. Some compilers check the format string and will generate an error without the proper number and type of arguments for things like printf(...) and scanf(...).
2007-02-26, 7846👍, 0💬
Can one change the mouse pointer in Forms? The SET_APPLICATION_PROPERTY build-in in Oracle Forms all...
How To Dump the Contents of a Directory into an Array? - PHP Script Tips - Working with Directoris a...
.NET INTERVIEW QUESTIONS - How to prevent my .NET DLL to be decompiled? By design .NET embeds rich M...
How To Remove the Top White Space of Your Web Page? - CSS Tutorials - Introduction To CSS Basics The...
What exactly happens when ASPX page is requested from Browser? Note: - Here the interviewer is expec...