In 'comp.lang.c', Keith <no****@nospam.com> wrote:
I receive compiler error messge: "integral constant expression expected"
for:
somefunc(char *bar)
{
char foo[2*strlen(bar)];
}
Is there any way around this? I am using SunWorkStop 5.0.
#include <stdlib.h>
somefunc(char *bar)
{
char *foo = malloc (2 * strlen(bar));
/* + 1 if you need room for the final 0. */
if (foo != NULL)
{
/* use it ... */
/* ... and when finished : */
free (foo);
}
}
--
-ed-
em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ:
http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c :
http://www.isty-info.uvsq.fr/~rumeau/fclc/