Re: structure pointers
- From: "Fred Kleinschmidt" <fred.l.kleinmschmidt@xxxxxxxxxx>
- Date: Mon, 30 Oct 2006 15:52:47 GMT
"raghu" <ragavakumar@xxxxxxxxx> wrote in message
news:1162192614.605043.263510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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;Another problem here. What is t.q?
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;
You have not assigned q to point anywhere
--
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
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project
.
- References:
- structure pointers
- From: raghu
- structure pointers
- Prev by Date: Re: if clause
- Next by Date: Re: how to use bit operation to do \sqrt(n)
- Previous by thread: Re: structure pointers
- Next by thread: I have a problem in my study
- Index(es):
Relevant Pages
|
|