为什么一个参数能储存 另外一个不能
各位大侠 打扰了 有一个简单的程序 两个参数输出 为什么只有nx能输出 而hx输出为零呢 ?可直接运行得结果,请各位帮忙,感谢。
程序代码:#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct
{
double hx;
int nx;
} Level;
typedef struct
{
Level *Lk;
} Stack;
void initialize(Stack *V, int nx0)
{
Level *L;
V->Lk=(Level *)calloc(1,sizeof(Level));
L=V->Lk+1;
L->hx=nx0/2;
L->nx=nx0;
printf("\n level: nx=%d hx=%f",L->nx,L->hx);
}
void init_p(Stack *V, int c)
{
Level *L;
L=V->Lk+c;
printf("\nnx is %d",L->nx);
printf("\nhx is %d\n",L->hx);
}
void main()
{
Stack V;
initialize(&V,5);
init_p(&V,1);
}






