Uses a pointer-to-function to invoke a function. - C Pointer

C examples for Pointer:Function Pointer

Description

Uses a pointer-to-function to invoke a function.

Demo Code

#include <stdio.h>

void welcome(void);

int main(){/*from ww  w  . ja  v  a 2 s  . c  om*/
      void (*ptrFunc)();
      ptrFunc = welcome;
      (*ptrFunc)();
      return(0);
}

void welcome(void)
{
     printf("hi.\n");
     return;
}

Result


Related Tutorials