Re: declaration of variable in for loop
- From: roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson)
- Date: Thu, 31 Jan 2008 14:23:14 +0000 (UTC)
In article <fns04t$ve0$1@xxxxxxxx>, santosh <santosh.k83@xxxxxxxxx> wrote:
poornimamprabhu@xxxxxxxxx wrote:
printf("%d %p = *%d\n",i,&k,k);
You probably want:
printf("%d\t%p = %d\n", i, (void *)&k, k);
Also the '*' character in your format string
specifies that the following formatting operation be of the minimum
field width specified by the corresponding argument to '*'. In this
case it is the fourth printf() argument and thus, the final 'd'
specifier is left without an argument, invoking undefined behaviour.
That only applies if the * follows the %. Outside of a % specifier,
an * represents the literal character '*'.
--
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth
.
- References:
- declaration of variable in for loop
- From: poornimamprabhu
- Re: declaration of variable in for loop
- From: santosh
- declaration of variable in for loop
- Prev by Date: #define
- Next by Date: Re: #define
- Previous by thread: Re: declaration of variable in for loop
- Next by thread: Re: declaration of variable in for loop
- Index(es):
Relevant Pages
|