首页 > 其他 > 详细

c pointer

时间:2020-02-29 18:08:44      阅读:75      评论:0      收藏:0      [点我收藏+]
#define <stdio.h>
#define <stdlib.h>
#define STU_SIZE sizeof(stu)
typedef struct student{
int id;
struct student* next;
}stu;
void p_list(stu *node);
int main(int argc, char** argv) {

stu* head;
stu* temp;
head = NULL;
for(int i = 0; i < 20; i ++){
temp = malloc(STU_SIZE);
temp->id = i;
i += 2;
temp->next = head;
head = temp;
}
p_list(head);
return 0;
}

void p_list(stu* node){
while(node != NULL){
printf("id:%d\thead:%d\thead->next:%d\n", node->id, node, node->next);
node = node->next;
}
}

c pointer

原文:https://www.cnblogs.com/zjhangia/p/12384333.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!