M
mdh
I am trying to define a struct called temp, using this code. Please be
kind in explaining with this is not working
#include <stdio.h>
#include <stdlib.h>
struct t_node_n{
char *word;
int match;
struct t_node_n *left;
struct t_node_n *right;
};
struct t_node_n *temp = (struct t_node_n *) malloc(sizeof(struct
t_node_n)); /* error: initializer element is not constant */
int main {};
So, this is what I **thought** I was doing.
Create a pointer of type struct t_node_n called "temp".
Define the pointer "temp" by calling malloc....which I **thought**
gives the pointer "memory" to point to, thus defines it?
Clearly these thoughts are way off base!!
Thanks
kind in explaining with this is not working
#include <stdio.h>
#include <stdlib.h>
struct t_node_n{
char *word;
int match;
struct t_node_n *left;
struct t_node_n *right;
};
struct t_node_n *temp = (struct t_node_n *) malloc(sizeof(struct
t_node_n)); /* error: initializer element is not constant */
int main {};
So, this is what I **thought** I was doing.
Create a pointer of type struct t_node_n called "temp".
Define the pointer "temp" by calling malloc....which I **thought**
gives the pointer "memory" to point to, thus defines it?
Clearly these thoughts are way off base!!
Thanks