Re: [algogeeks] Re: how we can access 2nd element of an struct

2010-09-09 Thread Sathaiah Dontula
I think the question should have been quite generic, if it is integer you can go from the void pointer to four bytes ( sizeof(int)) ahead and get the next number that is what is required for us. But what if we do not know what is the member type is ?, How we can get the second member if the first m

[algogeeks] Re: how we can access 2nd element of an struct

2010-09-09 Thread soundar
can you explain?thanks in advance -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

[algogeeks] Re: how we can access 2nd element of an struct

2010-09-09 Thread soundar
It is giving me error."invalid cast from type ‘main()::node’ to type ‘char*" -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email t

Re: [algogeeks] Re: how we can access 2nd element of an struct

2010-09-09 Thread rahul patil
On Thu, Sep 9, 2010 at 12:17 PM, ram das wrote: > thanks this seems fine. > > > On Wed, Sep 8, 2010 at 1:02 AM, albert theboss wrote: > >> >> typedef struct list node; >> >> node a; >> >> (float*)((char*)a+2) >> > you have use 2 as a hardcoded size of integer are you looking for following struc

Re: [algogeeks] Re: how we can access 2nd element of an struct

2010-09-08 Thread ram das
thanks this seems fine. On Wed, Sep 8, 2010 at 1:02 AM, albert theboss wrote: > > typedef struct list node; > > node a; > > (float*)((char*)a+2) > > is it correct ?? > correct me i am wrong > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks"

Re: [algogeeks] Re: how we can access 2nd element of an struct

2010-09-08 Thread saurabh agrawal
what if there are more than two elements? On Wed, Sep 8, 2010 at 10:00 PM, subramani s wrote: > struct list node; > a=(float *)((char *)a+sizeof(node)-4); > > correct me if i am wrong > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. >

Re: [algogeeks] Re: how we can access 2nd element of an struct

2010-09-08 Thread subramani s
struct list node; a=(float *)((char *)a+sizeof(node)-4); correct me if i am wrong -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: how we can access 2nd element of an struct

2010-09-07 Thread albert theboss
typedef struct list node; node a; (float*)((char*)a+2) is it correct ?? correct me i am wrong -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this gro

[algogeeks] Re: how we can access 2nd element of an struct

2010-09-07 Thread soundar
u didn't give any name for the structure so it'll give error.correct me if i am wrong -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email