Re: Help with understanding this please
- From: mdh <mdeh@xxxxxxxxxxx>
- Date: Sat, 30 Aug 2008 07:22:58 -0700 (PDT)
On Aug 30, 7:11 am, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
mdh said:
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.
Richard...before I rest so that sleep can be calm!!, may I ask why you
have not cast the return from malloc to type "struct t_node n *). K&R
devote quite a discussion to this on page 142.
Thanks as always.
.
- Follow-Ups:
- Re: Help with understanding this please
- From: Mark McIntyre
- Re: Help with understanding this please
- References:
- Re: Help with understanding this please
- From: Richard Heathfield
- Re: Help with understanding this please
- Prev by Date: Re: Help with understanding this please
- Next by Date: Re: Help with understanding this please
- Previous by thread: Re: Help with understanding this please
- Next by thread: Re: Help with understanding this please
- Index(es):
Relevant Pages
|