Thu Nov 13, 2008 2:49 pm
/* Some pointer games. */
#include <stdio.h>
int fred(int *z)
{
int q = *z;
*z = 15;
return 2*q;
}
int main()
{
int m = 5, n = 10;
int *ip, *ip2;
ip = &m;
ip2 = &n;
*ip = 77;
*ip2 = -485;
printf("A: %d %d\n", m, n);
*ip2 = *ip;
printf("B: %d %d\n", m, n);
ip2 = ip;
*ip = 100;
*ip2 = 200;
printf("C: %d %d\n", m, n);
m = fred(&n);
printf("D: %d %d\n", m, n);
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.