jof <jo****@rediffmail.com> wrote:
struct name
{
char ch;
} *ptr1,*ptr2;
If this is my structure and if i need to store the address of the pointers
ptr1 and ptr2 in an array say "del"..how do i do it?
is it right if:
struct name
{
char ch;
}*ptr1,*ptr2,*del[5];
and in the main:
del[0]=ptr1;
giving me error--it says teh subscripted value is neither an array nor a
pointer!!!
Looks rather fine and e.g.
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
struct name {
char c;
} *ptr1, *ptr2, *del[ 2 ];
del[ 0 ] = ptr1;
del[ 1 ] = ptr2;
return EXIT_SUCCESS;
}
compiles without problems. The error message you get makes it rather
look like 'del' isn't what you assume it to be. Did you for example
define the stucture pointers and the 'del' array of pointers as
global variables and have another variable, accidentally also called
'del', defined locally within the function?
Regards, Jens
--
\ Jens Thoms Toerring ___
Je***********@physik.fu-berlin.de
\__________________________
http://www.toerring.de