Re: [cc65] malloc and Sort.c(26): Error: Expression expected

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-03-04 12:12:46


On Mon, Mar 03, 2003 at 10:46:20PM -0800, Greg Long wrote:
> 	ra = (unsigned int*) malloc(sizeof(unsigned int[size] ));

In C, the cast is not needed, and the argument to the sizeof operator is not
valid. Use

        ra = (unsigned int*) malloc (size * sizeof unsigned);

or something similar.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-03-04 12:12:52 CET