#include <stdio.h>
int* Slot_State(void) //定义一个指针函数,该函数的返回值是int*类型的指针
{
static int r[10];
int i;
for ( i = 0; i < 10; ++i)
{
r[i] = i;
printf( "r[%d] = %d\n", i, r[i]);
}
return r;
}
typedef struct
{
int* Slot_State(void);
}Backboard_Agreement,*P_Backboard_Agreement;
int main ()
{
int i;
Backboard_Agreement Backboard;
P_Slot_State =Backboard.(Slot_State()); //指针P指向改函数的首地址
for ( i = 0; i < 10; i++ )
{
printf( "*(P_Slot_State + %d) : %d\n", i, *(P_Slot_State + i));
}
return 0;
}