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

Date view Thread view Subject view

From: Ullrich von Bassewitz (
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.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to 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