Re: [Dev-C++] Struckts and pointer .......
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <Met...@ao...> - 2002-08-29 10:03:08
|
Did you allocated the memory needed by the data element pointed to by the
struct pointer ?
Ie :
typedef struct _s
{
int x,y;
struct -s *next=NULL;
}
struct _s foo;
struct_s bar;
If you wish to make the foo.next elemnt to point to bar, you must :
foo.next=(struct _s*)malloc(sizeof(struct _s));
foo.next=bar;
Kind regards
--
Seb
|