ReadEasy

10 11月, 2012

C Pointer , Function pointer

#include 

int func(int x,int y){

    printf("func() called\n");
    return x+y;
}

int main(){

    int a = 999;
    int *p = &a;


    printf("%d\n", &a);
    printf("%d\n", *p);
    (*p)++;
    printf("%d\n\n", a);

    int (*pFunc)(int,int) = &func;
    printf( "%d", pFunc(9,9) );

    return 0;
}

沒有留言:

張貼留言