Example one: function pointers
Note that the pointer function is different from the function pointer representation method, so don't confuse it. The simplest way to discern is to see if the pointer in front of the function name is enclosed in parentheses (), and if it is included as a function pointer, the pointer function if no parentheses include *.
Pointer function: When a function declares its return value as a pointer, it actually returns an address to the calling function for use in an expression that requires a pointer or address.
#include"stdio.h"int* GetDate (intWkintdy); intMain () {intWk,dy; Do{puts ("Enter Week (1-5) Day (1-7)"); scanf ("%d%d",&wk,&dy); } while(wk<1|| Wk>5|| dy<1|| Dy>7); printf ("%d\n",*GetDate (Wk,dy)); }int* GetDate (intWkintdy) { Static intcalendar[5][7]= { {1,2,3,4,5,6,7}, {8,9,Ten, One, A, -, -}, { the, -, -, -, +, -, +}, { A, at, -, -, -, -, -}, { in, -, to,-1} }; return&calendar[wk-1][dy-1]; }
#include"stdio.h"intMain () {Chara[]="abcdef";p rintf ("This is an address of an array element%x\n", a);p rintf ("This is an entire first address of an array object%x\n",&a);p rintf ("%d\n",sizeof(* (A +1)) );p rintf ("%d\n",sizeof((&a+1))); return 0; }
C-language pointer function and function pointer