C?????б??????????????
???????????? ???????[ 2013/2/25 10:10:24 ] ????????
?????????????????????????????????????????????б?????????????嶨?壺
#ifndef __POINT_H
#define __POINT_H
typedef struct _Point Point;
struct _Point {
int x;
int y;
};
#endif
#include "point.h"
Point *n = (Point *) calloc(1?? sizeof(Point));
n->x = 1;
n->y = 2;
....
????????????????????????????????????????????????????棬???????????в???????????????????????????塣????????????????????????????????????????????????????Щ?????????????????????????????嶨?塣
????????????????н????????????????????????????????????????????????????????????????????????Java/C++???????????????????
????1?????????????????????
????typedef struct Point *Point??
?????????????????п???????塣
????2????????????????????з????????????????з??????????????б??????????????ζ?????????????????????????÷??????????ɡ?
??????????????
????????point.h??
#ifndef __POINT_H
#define __POINT_H
typedef struct _Point *Point;
Point make_point();
void print_point(Point point);
void destroy_point(Point p);
#endif
?????????????point.c
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "point.h"
struct _Point {
int x;
int y;
};
Point make_point() {
Point point = (Point) calloc(1?? sizeof(struct _Point));
point->x = 0;
point->y = 0;
return point;
}
void print_point(Point point) {
printf("point %d?? %d
"?? point->x?? point->y);
}
void destroy_point(Point p) {
if (p == NULL) {
printf("warning?? destroying NULL object");
return;
}
free(p);
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11