Re: Help with understanding this please
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Sat, 30 Aug 2008 14:11:18 +0000
mdh said:
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));
Better: struct t_node_n *temp = malloc(sizeof *temp);
Cleaner, tighter, less maintenance hassle.
/* error: initializer element is not constant */
Yes. You can't call a function except from within a function.
int main {};
Hmmm. I think you've been awake far too long. Get some rest. :-)
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: Help with understanding this please
- From: mdh
- Re: Help with understanding this please
- From: mdh
- Re: Help with understanding this please
- Prev by Date: Re: char**
- Next by Date: Re: Help with understanding this please
- Previous by thread: Re: char**
- Next by thread: Re: Help with understanding this please
- Index(es):
Relevant Pages
|