软件

c 实现private功能

/**
 * @file    amg88xx.c
 * @author  tymaker
 * @version V1.0.0
 * @date    2019-01-17 2019
 * @brief   GUI TrackBar module
 */

/* Includes ------------------------------------------------------------------*/
#include "amg88xx.h"


struct stu {

    char id[10];
    int score;
};


struct stu *new_stu() {

    struct stu *s;
    s = (struct stu *)_malloc(sizeof(struct stu));

    return s;
}


void init(struct a* ptr) {

    ptr->s = new_stu();

}


void set_id(struct stu *s, char *id) {

    strcpy(s->id, id);
}


char *get_id(struct stu *s) {

    return s->id;
}


/********************************End of File************************************/


/**
 * @file    amg88xx.h
 * @author  tymaker
 * @version V1.0.0
 * @date    2019-01-17 2019
 * @brief   GUI TrackBar module
 */

#ifndef __AMG88XX_H_
#define __AMG88XX_H_

/* Includes ------------------------------------------------------------------*/

#if(ENABLE_MALLOC == true)
  #include "malloc.h"
#endif
#include "string.h"


#define ENABLE_MALLOC  true



struct stu;


struct a{

    struct stu *s;
    void (*f)(void);
    void (*begin)(struct a* ptr);
};

void init(struct a* ptr);

extern void set_id(struct stu *s,char *id);

extern char *get_id(struct stu *s);

extern struct stu *new_stu();

#endif



/********************************End of File************************************/

回复

This is just a placeholder img.