This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem in ascessing structure member


hi,
I have written a small program contaning 3 structures.
i am not able to write to structure member b of struct inst using str1.
i am geeting address out of bounds.
is there any solution to this.

the program is :

typedef struct{
	short b;
}inst;

typedef struct{
	char a;
	inst *ptr;
}str1;

typedef struct{
	char a;
	inst *ptr;
}str2;

void procedureA(cyg_addrword_t data)
{
	str1 s1;
	str2 s2;
	s1.a='a';
	s1.ptr->b=10;
	printf("%c %c\n",s1.a,s2.a);
	printf("%d %d \n",s1.ptr->b,s2.ptr->b);
	//printf(" %d = size of \n",sizeof(numbers));
}

regards.

Aravind B



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]