why does this error
result from this codeCode:error C2057: expected constant expression
I want to avoid using malloc.Code:int foo(char *bar) { char blob[strlen(bar)]; ...
why does this error
result from this codeCode:error C2057: expected constant expression
I want to avoid using malloc.Code:int foo(char *bar) { char blob[strlen(bar)]; ...
Last edited by Brian; 12-03-2003 at 02:13 PM.
anytype ARRAY[must be constant ];
If you need variable size...... malloc() it.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
well it works now after i've turned off a few project options.
msvc sucks.
Its not msvc that sucks its c itself. c89 definately prohibits variable sized arrays. c99 may allow it. im not sure. I suppose if you turn on the c99 compile switch it may compile. What have you got against malloc?
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
Dontcha just love ppl who still can't tell the difference between C and C++
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.