[Solved] Make a new pointer in a loop C


i and id are both local variables with automatic storage (commonly referred to as on the stack). No new instances are created upon each iteration of the loop, the same space is reused and a new value is stored in id, hence the same addresses printed by printf.

Note that the value of id is not guaranteed to be preserved across iterations since it goes out of scope at the end of the block forming the body of the for loop.

0

solved Make a new pointer in a loop C