R
raghu
Hello
This is Raghu. I have a problem in the pointers.
The code is
typedef struct Tlv{
/*type Length value for each
message */
unsigned char ucType; /*Type varies from message to
message */
unsigned short usLength;/*Length */
unsigned int ucValue;/*Value*/
}tlv;
typedef struct te{
char d;
int e;
}Q;
struct temp{
int a;
unsigned int c;
Q *q;
tlv *T;
};
struct temp t;
t.a = 4;
t.c = 31;
t.q[0].d =21;
t.q[0].e = 23;
t.q[1].d = 11;
t.q[1].e = 4;
t.T -> ucType = 1;
t.T -> usLength = 11;
t.T -> ucValue = 21;
printf("The entered values are ");
printf("%d\n%d\n", t.a, t.c);
printf(" %d \n", t.q[0].d);
printf(" %d \n",t.T->ucType);
return 0;
}
when I run this program some error is generating that is Segmentation
fault.
Can you please help me.
Thanks in advance.
-Bye
Raghu
This is Raghu. I have a problem in the pointers.
The code is
typedef struct Tlv{
/*type Length value for each
message */
unsigned char ucType; /*Type varies from message to
message */
unsigned short usLength;/*Length */
unsigned int ucValue;/*Value*/
}tlv;
typedef struct te{
char d;
int e;
}Q;
struct temp{
int a;
unsigned int c;
Q *q;
tlv *T;
};
struct temp t;
t.a = 4;
t.c = 31;
t.q[0].d =21;
t.q[0].e = 23;
t.q[1].d = 11;
t.q[1].e = 4;
t.T -> ucType = 1;
t.T -> usLength = 11;
t.T -> ucValue = 21;
printf("The entered values are ");
printf("%d\n%d\n", t.a, t.c);
printf(" %d \n", t.q[0].d);
printf(" %d \n",t.T->ucType);
return 0;
}
when I run this program some error is generating that is Segmentation
fault.
Can you please help me.
Thanks in advance.
-Bye
Raghu