thanks
> When you say "until i" can you provide the code you
> are using for the loop?
for(int j=0; j<i; j++)
buf[i] = 0;
> I don't see why they are not giving you compile errors
> since the size of an array is supposed to be a const
> or a literal, not a variable.
so u are saying in declaration of a array size should be a compile
time constant?
--- In [email protected], Ray Devore <[EMAIL PROTECTED]> wrote:
>
> --- Indika Bandara <[EMAIL PROTECTED]> wrote:
> > is this ok? this works sometimes
> >
> > 1)
> > func(int i)
> > {
> > char buf[i];
> > // access buf until i
> >
> > }
> > usage:
> > func(5);
> >
> >
> > 2)
> > func()
> > {
> > int i = 5;
> > char buf[i];
> > // access buf until i
> >
> > }
> >
> >
> > will these not produce segfaults? then why?
> >
> >
> I don't see why they are not giving you compile errors
> since the size of an array is supposed to be a const
> or a literal, not a variable.
>
> When you say "until i" can you provide the code you
> are using for the loop? If you are using the value at
> buf[i] then you should be a segfault sometimes. It
> depends on whether you have control of that address or
> some other program does.
>
> Need more information.
>
> Ray
>
>
>
>
____________________________________________________________________________________Be
a better Heartthrob. Get better relationship answers from someone who
knows. Yahoo! Answers - Check it out.
> http://answers.yahoo.com/dir/?link=list&sid=396545433
>