Re: declaration of variable in for loop
- From: Army1987 <army1987@xxxxxxxxx>
- Date: Thu, 31 Jan 2008 15:11:25 +0000 (UTC)
poornimamprabhu wrote:
Hi there,The compiler *is* allowed to place k in a different place each time, but,
suppose i have piece of code like
main()
{
int i,j;
for(i=0;i<10;i++){
int k = i;
printf("%d %p = *%d\n",i,&k,k);
}
}
When i see the address of K its same in all iterations.That means K is
only defined once at a time.
why should it?
--
Army1987 (Replace "NOSPAM" with "email")
.
- References:
- declaration of variable in for loop
- From: poornimamprabhu
- declaration of variable in for loop
- Prev by Date: Re: How Do You Pronounce char?
- Next by Date: Re: Type conversion
- Previous by thread: Re: declaration of variable in for loop
- Next by thread: Re: declaration of variable in for loop
- Index(es):