直接上代码

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

typedef struct
{
char name[10];
int age;
int high;
}student;

//结构体组包
void test_pack()
{
char pack_body[100] = {0};
char *wang_name = "ming";
student ming;
memcpy(ming.name,wang_name,5);
ming.age = 19;
ming.high = 178;
memcpy(pack_body,&ming,sizeof(student));
memcpy(pack_body+(sizeof(student)),"0123456789",10);
printf("pack_body len = %d",strlen(pack_body));
student *head = (student*)pack_body;
printf("student:%s,%d,%d",head->name,head->age,head->high);
}

//指针函数的函数指针测试
int g_value = 10;
int *ptr_fnc(void)
{
g_value = 100;
return &g_value;
}
void test_ptr_fnc()
{
int *(*pfnc)(void);
pfnc = ptr_fnc;
int *result = pfnc();
printf("test_ptr_fnc %d",*result);
}