Re: Help with understanding this please



Richard Heathfield <rjh@xxxxxxxxxxxxxxx> writes:

mdh said:

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 *).

Why on earth would I do that? What good could it possibly do?

Yeah because C++ is wrong and so was pre Ansi C.

Streuth.
.



Relevant Pages

  • Re: Help with understanding this please
    ... Cleaner, tighter, less maintenance hassle. ... Richard...before I rest so that sleep can be calm!!, ... devote quite a discussion to this on page 142. ...
    (comp.lang.c)
  • Re: Help with understanding this please
    ... Cleaner, tighter, less maintenance hassle. ...
    (comp.lang.c)
  • Re: RA - questions
    ... I just need a decent nights ... sleep to help me get thru the day. ... OK, I'm not a doctor. ... some prednisone for a short time to calm it down. ...
    (alt.support.arthritis)
  • Re: dirty boy
    ... calm him to sleep. ... drift off after a few minutes. ... I can't imagine a 9 week old dog humping like that, ...
    (rec.pets.dogs.behavior)
  • RIP Brian Renshaw Artist
    ... Brian Renshaw died in his sleep last Thursday night. ... A gentle modest man who now gone from among us, his calm, atmospheric paintings of old town Hastings will remain as a tribute to his skill and depth of insight. ...
    (soc.culture.scottish)