M
Mars
I followed the reference about ADT,
and wrote something like below....
#include <stdio.h>
/* I intend to make this a list */
struct node_s
{
int x;
struct node_s * next;
};
typedef struct node_s node;
int main(void)
{
node anode;
/* is this corrent? */
anode.next=(node *)malloc(sizeof(node));
anode.next.x=1;
return 1;
}
The code gives
"error: request for member 'x' in something not a structure or union"
and wrote something like below....
#include <stdio.h>
/* I intend to make this a list */
struct node_s
{
int x;
struct node_s * next;
};
typedef struct node_s node;
int main(void)
{
node anode;
/* is this corrent? */
anode.next=(node *)malloc(sizeof(node));
anode.next.x=1;
return 1;
}
The code gives
"error: request for member 'x' in something not a structure or union"