K
Keith Thompson
sake said:hey
this doesn't work in my enviorment.
"doesn't work" is one of the less useful problem descriptions. *How*
doesn't it work? What behavior did you expect, what did you see, and
how do they differ?
*ptr is actually the value pointed to and ptr is the pointer.
you verify this implicitly by printing the value with *ptr.
Of course.
Ian did omit the "=" for the initializer, which would cause a
compile-time error; is that what you mean by "doesn't work"? If not,
try to compile and execute this program:
#include <stdio.h>
int main(void) {
int n = 42;
int *ptr = &n;
printf( "%d %d\n", n, *ptr );
return 0;
}
The output should be a single line of text, "42 42". If you get
anything else (including nothing), then we can discuss what's going
wrong.