S
sushil
+1 #include<stdio.h>
+2 #include <stdlib.h>
+3 typedef struct
+4 {
+5 unsigned int PID;
+6 unsigned int CID;
+7 } T_ID;
+8
+9 typedef unsigned int (*T_HANDLER)(void);
+10
+11 void Display1(void);
+12 void Display2(void);
+13
+14 int main()
+15 {
+16 T_HANDLER A_HANDLER[3] = { (T_HANDLER)Display1,
+17 (T_HANDLER)Display2};
+18
+19 (A_HANDLER[0])();
+20 (*A_HANDLER[1])();
^ Is this '*' required ?
+21 return 1;
+22 }
+23
+24 void Display1()
+25 {
+26 printf("\nDisplay1 called\n");
+27 }
+28
+29 void Display2()
+30 {
+31 printf("\nDisplay2 called\n");
+32 }
Hi,
I am new to group. I just tried to run a code with array of function pointer.
I could not understand why there is no error due to '*' at line no. 20.
Could anybody help me ?
Regards,
Sushil.
+2 #include <stdlib.h>
+3 typedef struct
+4 {
+5 unsigned int PID;
+6 unsigned int CID;
+7 } T_ID;
+8
+9 typedef unsigned int (*T_HANDLER)(void);
+10
+11 void Display1(void);
+12 void Display2(void);
+13
+14 int main()
+15 {
+16 T_HANDLER A_HANDLER[3] = { (T_HANDLER)Display1,
+17 (T_HANDLER)Display2};
+18
+19 (A_HANDLER[0])();
+20 (*A_HANDLER[1])();
^ Is this '*' required ?
+21 return 1;
+22 }
+23
+24 void Display1()
+25 {
+26 printf("\nDisplay1 called\n");
+27 }
+28
+29 void Display2()
+30 {
+31 printf("\nDisplay2 called\n");
+32 }
Hi,
I am new to group. I just tried to run a code with array of function pointer.
I could not understand why there is no error due to '*' at line no. 20.
Could anybody help me ?
Regards,
Sushil.