Re: Variable array size allocation

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



#include "stdio.h"

main()
{

int size=10;
char* buffer = (char*)malloc(size*sizeof(char));


}

test.c(7) : warning C4013: 'malloc' undefined; assuming extern returning int

test.obj - 0 error(s), 1 warning(s)
------------------------------------------------------

........................ > <





<adebaene@xxxxxxxxxxxxxxxx>
???????:1116333543.874671.209580@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

boki a écrit :
> C++ ok, C fail..... ><!!

You should have said from the beginning you're doing C (btw, have you
any good reason not to switch to C++ ???)

in C:
char* buffer = (char*)malloc(size*sizeof(char));

Arnaud
MVP - VC


.



Relevant Pages

  • Re: Variable array size allocation
    ... boki a écrit: ... You should have said from the beginning you're doing C (btw, ... any good reason not to switch to C++ ???) ...
    (microsoft.public.vc.language)
  • Re: HEADSUP usb2 (usb4bsd) to become default in 2 weeks.
    ... on Jan 3rd I will switch the GENERIC kernel to use ... is there any reason why this needs to be rushed in over the ... developer attention and updates (and yeah there might be painful ... and the milestones to take and open items. ...
    (freebsd-current)
  • Re: IMPLICIT NONE (F2k8+/-)
    ... The assertion that there is absolutely no good reason to continue with a convention that has served Fortran for 50 years, is itself, no good reason for change. ... Those of us who like implicit typing find that we can instantly recognize the type of a variable from its initial letter, provided that explicit typing has not been turned on. ... We have to conclude that only single variables are susceptible to mistyping and not being trapped. ... IMPLICIT NONE is the case that could be selected by a compiler switch, as the user of this option will have declared the type of every variable explicitly, and other than the case where the programmer has made an error, it is immaterial whether or not it is used. ...
    (comp.lang.fortran)
  • Re: The mechanism behind bouncing...
    ... I just wish to know the precise reason why for example, ... noise-free source like a mechanical switch. ... They do not scale with voltage? ... Your logic is like saying a resistor behaves exactly the same no matter what ...
    (sci.electronics.basics)
  • Re: whats the ifc corresponding argument for -bp in absoft f90
    ... > The problem is dsinwhere y is a single precision floating point while ... Guess I have to ask why you don't just fix the code? ... Is this the *ONLY* reason you are using the -dp option? ... I wouldn't guarantee that it necessarily has such a switch. ...
    (comp.lang.fortran)