编辑代码

#include <stdio.h>
#include <stdlib.h>
typedef struct st2 ST2;

typedef void (*FUNC)(ST2 *para);
typedef struct st1
{
    FUNC    func1;
} ST1;

typedef struct st2 
{
    ST1   *st1Cbs;
} ST2;

void print(int num)
{
    printf("Hello world! num is %d\n", num);
}

int main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 

    ST1 *st1Test = (ST1 *)malloc(sizeof(ST1));

    memset(st1Test, 0, sizeof(ST1));

    // ST2 *st2Test = (ST2 *)malloc(sizeof(ST2));

    // memset(st2Test, 0, sizeof(ST2));

    st1Test->func1 = print;

    st1Test->func1(2);
   
    return 0;
}