IQOD #9
Moving into some larger problems now since the little ones are getting a little boring
Remember NO COPYING & PASTING into your compiler etc to run it. Just read the code and figure out what it does.
Consider the following program
What is the output it generates?
Remember NO COPYING & PASTING into your compiler etc to run it. Just read the code and figure out what it does.Consider the following program
Code:
void(*p[2])(int *,int);
void f1(int* p, int q)
{
int tmp;
tmp = *p;
*p = q;
q = tmp;
}
void f2(int* p, int q)
{
int tmp;
tmp = *p;
*p = q;
q = tmp;
}
void main()
{
int a;
int b;
p[0] = f1;
p[1] = f2;
a = 3;
b = 5;
p[0](&a, b);
printf("%d\t %d\t", a, b);
p[1](&a, b);
printf("%d\t %d\t", a, b);
}
