[scilab-Users] C
Ronald Michaels
ron at phenotypescreening.com
Wed Mar 24 16:17:41 CET 2010
This compiles:
#include <stdio.h>
int var=1;
int *ptr;
main() {
ptr=&var;
printf("\nDirect access, var = %d", var);
printf("\nIndirect access, var = %d", *ptr);
printf("\n\nThe address of var = %lx", (long unsigned int)&var);
printf("\nThe address of var = %lx\n", (long unsigned int)ptr);
return 0;
}
note the lx which is long unsigned int and the cast to the variable.
This will print addresses out as long unsigned int.
Ron
On Tue, 2010-03-23 at 23:36 -0700, David Arnold wrote:
> #include <stdio.h>
>
> int var=1;
> int *ptr;
>
> main() {
>
> ptr=&var;
>
> printf("\nDirect access, var = %d", var);
> printf("\nIndirect access, var = %d", *ptr);
>
> printf("\n\nThe address of var = %d", &var);
> printf("\nThe address of var = %d\n", ptr);
>
> return 0;
>
> }
>
More information about the users
mailing list