C语言结构体指针,结构体数组 之间的赋值问题。

2025-02-27 00:13:18
推荐回答(2个)
回答1:

没有问题呀 这是我的测试代码
#include
#include
typedef struct ST_Jpeg_Data
{
char Buff[4];
char index;
long songIndex;
long checkIndex;

}t_t;
int main()
{
t_t a[10]={0};
t_t* t=NULL;
t=a;
strcpy(t->Buff,"ab");
t->index='b';
t->songIndex=1;
t->checkIndex=2;
t++;
strcpy(t->Buff,"cd");
t->index='d';
t->songIndex=3;
t->checkIndex=4;
printf("%s\t%c\n",a[0].Buff,a[0].index);
printf("%s\t%c\n",a[1].Buff,a[1].index);
return 0;
}

回答2:

这应该不可能吧。按理说是可以的,不妨把代码发来看看