1
edit
Changes
Week 5
,Created page with 'Creating pointers to functions type foo(type 1, type2, type3, etc); type (*P)(type1, type2, type3, etc); P is a pointer variable to a function foo. Assigning a function to a …'
Creating pointers to functions
type foo(type 1, type2, type3, etc);
type (*P)(type1, type2, type3, etc);
P is a pointer variable to a function foo.
Assigning a function to a pointer variable:
P = foo;
In C (or C++), x = (*P)(type1, type2, type3);
In C++, x = P(y, z, x);
In C, everything upcasts. (so if you have an expression, it will upcast all the variables to the largest type).
type foo(type 1, type2, type3, etc);
type (*P)(type1, type2, type3, etc);
P is a pointer variable to a function foo.
Assigning a function to a pointer variable:
P = foo;
In C (or C++), x = (*P)(type1, type2, type3);
In C++, x = P(y, z, x);
In C, everything upcasts. (so if you have an expression, it will upcast all the variables to the largest type).