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

2010-09-09 Thread ram das
thanks this seems fine. On Wed, Sep 8, 2010 at 1:02 AM, albert theboss alberttheb...@gmail.comwrote: 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

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

2010-09-07 Thread ram das
how we can access 2nd element of an struct defined as struct { int a; flaot b; } we have given a void pointer of this struct. we dont know what is the structre only knows 2nd element is a flaot type. -- Thanks Regards Ram Narayan Das mob: +91 9177711195 -- You received this message because

Re: [algogeeks] linked list

2010-08-20 Thread ram das
that's because you are creating char str[20]; on the stack so when the function createList completes all str [20] will be deleted from stack as a part of stack unwinding. and next you are calling display where all the references to name is removed and you are getting gabage value.to avoid this you

Re: [algogeeks] linked list

2010-08-19 Thread ram das
make declaration of char str[20] to char *str=(char*)malloc(20*sizeof(char)); and it will work . On Wed, Aug 18, 2010 at 11:23 PM, Raj Jagvanshi raj.jagvan...@gmail.comwrote: wats d problem in my display() #includeiostream #includemalloc.h #include string.h using namespace std;

Re: [algogeeks] linked list

2010-08-19 Thread ram das
no it head to head-next at the end of for loop block not at the beginning. try out this for (int t=0;t5;t++) cout\nt; On Thu, Aug 19, 2010 at 5:22 PM, vineeth mohan vm.vineethmo...@gmail.comwrote: void display(Node *head) { cout\n; for( ; head ; head=head-next)

Re: [algogeeks] 0's and 1's yet again!!!

2010-08-19 Thread ram das
shiftZeroOne(int *arr,int size) { int odd=1,even=0; while(odd = size even =size) { if ( arr[even] != 1 ) even+=2; if ( arr[odd] != 0 ) odd+=2; if ( arr[even] == 1 arr[odd] == 0 ) { arr[even]=0;

Re: [algogeeks] 0's and 1's yet again!!!

2010-08-19 Thread ram das
; } } } On Thu, Aug 19, 2010 at 7:00 PM, ram das ramnaraya...@gmail.com wrote: shiftZeroOne(int *arr,int size) { int odd=1,even=0; while(odd = size even =size) { if ( arr[even] != 1 ) even+=2; if ( arr[odd] != 0 ) odd