Open main menu

CDOT Wiki β

Changes

Week 5

390 bytes added, 12:40, 9 June 2010
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).
1
edit