incrementing the address ofn initialised structure

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
hi,
i am trying to increment the address of an initialised structure.but it
is always showing/printing the same address even after incrementing the
address.

code part:
struct codestruct { init i; int j};
struct codestruct initstruct = ;
struct ptrstruct = &initstruct;
for(INT I+):I<3;i++)
printf("\n ptrstruct = %d \n",ptrstruct);
ptrstruct++;
}


Re: incrementing the address ofn initialised structure
Try:

struct codestruct { init i; int j};
struct codestruct initstruct = ;
struct codestruct  *ptrstruct = &initstruct; /* CHANGED */
for(I=0:I<3;I++)
{
printf("\n ptrstruct = %d \n",ptrstruct);
ptrstruct++;
}

--


Regards,


Graham Baxter
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline