| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
 Reworld，下班在家制作游戏，1500万奖金等你拿 以码会友 以友辅仁

已结贴   问题点数：20  回复次数：9

struct book{};

struct book a[100];
struct book temp={};//初始化并赋值

得分:7

```struct data
{
char *String;
}```

[fly]存在即是合理[/fly]
得分:0

得分:7

得分:7

```#include<stdio.h>
#include<stdlib.h>
int main()
{
struct book{
int no;
int *p;
}a[2];
int i;

a[0].no=0;
a[0].p=(int *)malloc(sizeof(int));
*a[0].p=1;

a[1]=a[0];
printf("the a[1]'s no is:%d\n",a[1].no);
printf("the a[1]'s p 's value is %d\n",*(a[1].p));

return 0;
}```

the a[1]'s no is:0
the a[1]'s p 's value is 1

得分:0

```#include <stdio.h>
#include <stdlib.h>

int main(void)
{
struct data{int *p;} a, b;
a.p = (int *)malloc(sizeof(int));
*(a.p) = 0;

b = a;
printf("a.p = %p\n", a.p);
printf("a.p = %d\n", *(a.p));
printf("b.p = %p\n", b.p);
printf("b.p = %d\n", *(b.p));

*(b.p) = 1;
printf("a.p = %p\n", a.p);
printf("a.p = %d\n", *(a.p));
printf("b.p = %p\n", b.p);
printf("b.p = %d\n", *(b.p));

free(b.p);
printf("a.p = %p\n", a.p);
printf("a.p = %d\n", *(a.p));
printf("b.p = %p\n", b.p);
printf("b.p = %d\n", *(b.p));

*(b.p) = 1;
printf("a.p = %p\n", a.p);
printf("a.p = %d\n", *(a.p));
printf("b.p = %p\n", b.p);
printf("b.p = %d\n", *(b.p));

b.p = NULL;
printf("a.p = %p\n", a.p);
printf("a.p = %d\n", *(a.p));
printf("b.p = %p\n", b.p);
printf("b.p = %d\n", *(b.p));

*(b.p) = 1;
printf("a.p = %p\n", a.p);
printf("a.p = %d\n", *(a.p));
printf("b.p = %p\n", b.p);
printf("b.p = %d\n", *(b.p));

return 0;
}```

[fly]存在即是合理[/fly]
得分:0

得分:0

#include<stdio.h>
struct temp_state_data {
unsigned char state[6];
float state_data;};

int main()
{
int i;unsigned char temp='a';
struct temp_state_data data[3],temp_1;
for(i=0;i<6;i++)
data[0].state[i]=temp++;
data[0].state_data=1.0;

for(i=0;i<6;i++)
temp_1.state[i]=data[0].state[i];
temp_1.state_data=data[0].state_data;

data[1]=data[0];
data[2]=temp_1;

retrun 0;

}
得分:0

得分:0

• 10
• 1/1页
• 1