* simple printf
@ 2004-11-02 7:55 rinku rathore
2004-11-02 8:57 ` Glynn Clements
0 siblings, 1 reply; 2+ messages in thread
From: rinku rathore @ 2004-11-02 7:55 UTC (permalink / raw)
To: Vger Kernel
hello all,
what may be the out put of simple
printf("%d");
a garbage value or something else
Regards
Rinku
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: simple printf
2004-11-02 7:55 simple printf rinku rathore
@ 2004-11-02 8:57 ` Glynn Clements
0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2004-11-02 8:57 UTC (permalink / raw)
To: rinku rathore; +Cc: Vger Kernel
rinku rathore wrote:
> what may be the out put of simple
>
> printf("%d");
>
> a garbage value or something else
If you don't specify sufficient arguments, the result is "undefined".
On most common platforms, the function will just read whatever happens
to be at the relevant location on the stack. In this specific case,
printf() will just print some unspecified integer.
If the argument was a pointer, or an integer which was used in
computing a memory address (e.g. an array index), you would probably
get a segmentation fault (typically, less than half of the process'
address space is actually mapped to anything, so accessing a random
memory location would be more likely than not to access an unmapped
location).
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-02 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-02 7:55 simple printf rinku rathore
2004-11-02 8:57 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).