CBFalconer <> writes:
[...]
> The first thing that strikes is that the above printf is WRONG.
> You print pointers with a %p specifier.
More precisely, you print pointers of type void* with a %p specifier.
Other pointer types can be printed by explicitly converting them to
void*:
printf("ptr = %p\n", (void*)ptr);
> If using gcc, turn up the warning levels. I recommend at least:
>
> -W -wall -ansi -pedantic
That's "-Wall" (case is significant).
<OT>
gcc's "-W" is called "-Wextra" in newer gcc releases. You should pay
attention to any warnings produced with this setting, but not all of
them necessarily indicate real problems. See the gcc documentation
for details.
</OT>
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.