Author Topic: "dynamic" array in c  (Read 4804 times)

forestest

  • Guest
"dynamic" array in c
« on: May 06, 2011, 09:48:58 pm »
Hi there,
I'm using C::B for developing C-Progs with the gcc-Compiler,
Why does the gcc-Compiler allow (no error) the declaration of the following "dynamic" Array:
--
void plateau(int *messDaten, int datenAnzahl){
    int zwischenWert[datenAnzahl];//not allowed in C !?! malloc or similar memory-allocation required ... ?!?
    //...
--
Other Compilers would show up an error like "Constant Expression/Term expected" - so would I have ...
Thx for your comments

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: "dynamic" array in c
« Reply #1 on: May 06, 2011, 10:04:50 pm »
Ask in a compiler forum, not in a forum related to an IDE. To avoid confusion, next time read the forum rules before posting. Thank you.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ