Re: Dynamic Array



On Mon, 18 Apr 2005 23:17:27 +0200, in comp.lang.c , "Ronny Mandal"
<ronnyma@xxxxxxxxxxx> wrote:

>Thanks, your solution really worked, except that realloc() is a void*
>function,

This isn't going to cause any problems

>the program crashed when I tried to assign its "output" to a,
>which was the original array.

if a was a real array (as oppose to a pointer to something), you can't
assign to them. You've snipped too much context to be sure tho.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
.



Relevant Pages

  • Re: Dynamic Array
    ... Thanks, your solution really worked, except that realloc() is a void* ... which was the original array. ... Prev by Date: ...
    (comp.lang.c)
  • Re: Should function argument be changed in function body?
    ... >function body. ... >void foo1 ... >a code rule that argument should not be changed? ... CLC FAQ ...
    (comp.lang.c)
  • Re: char ** realloc
    ... When realloc fails, with the above you have introduced ... With realloc one should always use a temporary pointer to check ... Second, if *count is the size of the original array, increasing it ... If the reallocation was not successful the following code should not ...
    (comp.unix.programmer)
  • Re: print "foo" without using ;
    ... but perhaps surprising is the fact that Microsoft ... >> actually accepts void as a valid return type. ... >That web page refers to C++, ... CLC FAQ ...
    (comp.lang.c)
  • Re: print "foo" without using ;
    ... >> Fao, Sean wrote: ... immediately followed it by an example showing main returning void. ... CLC FAQ ...
    (comp.lang.c)