代码:
#include <stdio.h>
#include <stdlib.h>
struct super_block {
unsigned short s_ninodes;
unsigned short s_nzones;
};
#define NR_SUPER 8
struct super_block super_block[NR_SUPER];
int
main()
{
struct super_block * p;
struct super_block * s;
char b_data[] = "2020";
for(p = &super_block[0] ; p < &super_block[NR_SUPER] ; p++) {
p->s_ninodes= 0;
p->s_nzones = 0;
}
s = super_block;
*(s) = *((struct super_block *) b_data);
printf("%d\n%d\n", s->s_ninodes, s->s_nzones);
return 0;
}
问题是:我想
s->s_ninodes =20 and s->s_nzones=20, how to solve it ?
为什么"*(s) = *((struct super_block *) b_data);"
不行?
谢谢