Re: Variable array size allocation




boki a écrit :
> #include "stdio.h"
Add #include <stdlib.h> here.

>
> main()
> {
>
> int size=10;
> char* buffer = (char*)malloc(size*sizeof(char));
>
>
> }

Btw, you should learn to use the documentation that comes with your
compiler : malloc is clearly described in MSDN (look for the
"Requirement" paragraph).
Also, pick a good C introduction book, newsgroup are not well suited as
a teaching-from-scratch material.

Arnaud
MVP - VC

.



Relevant Pages

  • Re: read and write columns
    ... You attempt to open the same file, "data", for writing and reading, ... Read the documentation for fscanf. ... int main ...
    (comp.lang.c)
  • Re: Aggregation vs composition
    ... >> This is the diagram that we are discussing about. ... Not only does X destroy ... >> int, it has no other choice but doing so as it cannot prevent the ... >> on the clients sticking to the rules laid down by the documentation. ...
    (comp.object)
  • Re: Reading from a child processs standard error
    ... If you read the Remarks sections in the VS80 documentation for the ... StreamReader.Read(char, int, int) and the StreamReader.ReadBlockmethods ... program's standard error if there's any and not block if there isn't. ... You should be able to use the StandardError property to redirect stderr ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SuSE documentation
    ... > BTW, I see plenty of magazine articles on Linux, but I would never ... > consider describing them as part of the Linux documentation, ... > the documentation of a specific distribution.. ... and thanks BTW for continuing to be a focal point!). ...
    (alt.os.linux.suse)
  • qooxdoo report
    ... I will spend X hours finding the X lines of code I need to make something new work, like drag and drop from a datagrid cell to a search field. ... it is all there and in the end just takes a few lines of code but even with extensive documentation there is no substitute for experience to know exactly where to look and what to use. ... btw, part of the story here is that a table cell is not a widget in itself and all they documented was widget-to-widget d'n'd. ...
    (comp.lang.javascript)