当前位置: 技术问答>linux和unix
C语言编程遇到难题了··求帮忙
来源: 互联网 发布时间:2017-02-21
本文导语: 程序如下: 头文件 23 union { 24 char ch; 25 unsigned uch; 26 signed sch; 27 int in; 28 unsigned uin; 29 signed sin; 30 short int shin; 31 unsigned short ush; 32 signed short ssh; 33 long int lin; 34 unsigned long ulon; 35 ...
程序如下:
头文件
23 union {
24 char ch;
25 unsigned uch;
26 signed sch;
27 int in;
28 unsigned uin;
29 signed sin;
30 short int shin;
31 unsigned short ush;
32 signed short ssh;
33 long int lin;
34 unsigned long ulon;
35 signed long slon;
36 long long lonlon;
37 unsigned long long ulonlon;
38 float fl;
39 double dou;
40 }data;
41
42 typedef struct {
43 union data;
44 struct fun_data* next;//用于指向下一个参数
45 }fun_data;
54 struct afun_data{
55 char* fun_name;
56 fun_data* start_data;
57 struct afun_data* next;//用于指向下一个函数
58 struct afun_data* last;
59 } ;
60
61 pid_shm back_shm;
62 struct afun_data* fun_now;
63 fun_now=(struct afun_data*)malloc(sizeof(struct afun_data));
64 fun_data *data_now,pointb;
65 data_now=&pointb;
程序代码部分
40 void send_fun(char* a)
41 {
42 struct afun_data* fun_new;
43 fun_new=(struct afun_data*)malloc(sizeof(struct afun_data));
44 fun_new->fun_name=(char*)malloc(sizeof(char)+1);
45 fun_new->fun_name=a;
46 fun_now->next=(struct afun_data*)malloc(sizeof(struct afun_data));
47 fun_now->next=fun_new;
48 fun_new->last=(struct afun_data*)malloc(sizeof(struct afun_data));
49 fun_new->last=fun_now;
50 data_now=fun_new->start_data;
51 fun_now=fun_new;
52 }
双向链表,fun_now指向当前的,fun_new是新的
46和47会报错···求解析 就解答
没有多少分
头文件
23 union {
24 char ch;
25 unsigned uch;
26 signed sch;
27 int in;
28 unsigned uin;
29 signed sin;
30 short int shin;
31 unsigned short ush;
32 signed short ssh;
33 long int lin;
34 unsigned long ulon;
35 signed long slon;
36 long long lonlon;
37 unsigned long long ulonlon;
38 float fl;
39 double dou;
40 }data;
41
42 typedef struct {
43 union data;
44 struct fun_data* next;//用于指向下一个参数
45 }fun_data;
54 struct afun_data{
55 char* fun_name;
56 fun_data* start_data;
57 struct afun_data* next;//用于指向下一个函数
58 struct afun_data* last;
59 } ;
60
61 pid_shm back_shm;
62 struct afun_data* fun_now;
63 fun_now=(struct afun_data*)malloc(sizeof(struct afun_data));
64 fun_data *data_now,pointb;
65 data_now=&pointb;
程序代码部分
40 void send_fun(char* a)
41 {
42 struct afun_data* fun_new;
43 fun_new=(struct afun_data*)malloc(sizeof(struct afun_data));
44 fun_new->fun_name=(char*)malloc(sizeof(char)+1);
45 fun_new->fun_name=a;
46 fun_now->next=(struct afun_data*)malloc(sizeof(struct afun_data));
47 fun_now->next=fun_new;
48 fun_new->last=(struct afun_data*)malloc(sizeof(struct afun_data));
49 fun_new->last=fun_now;
50 data_now=fun_new->start_data;
51 fun_now=fun_new;
52 }
双向链表,fun_now指向当前的,fun_new是新的
46和47会报错···求解析 就解答
没有多少分
|
40 void send_fun(char* a)
41 {
42 struct afun_data* fun_new;
43 fun_new=(struct afun_data*)malloc(sizeof(struct afun_data));
44 fun_new->fun_name=(char*)malloc(sizeof(char)+1);
45 fun_new->fun_name=a;
47 fun_now->next=fun_new;
49 fun_new->last=fun_now;
50 data_now=fun_new->start_data;
51 fun_now=fun_new;
52 }
随便改了一下!
1.注意一下代码书写规范。
2.设置断点,单步跟踪调试是程序员必备技能之一。