Is this statement okay?

Member
Posts: 194
Joined: 2009.02
Post: #1
Would this be considered kosher in C?

void function(int w, int h)
{
int array[w][h];

}
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #2
I think that's allowed in C99.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
In older versions of C you would need to malloc() memory to create variable sized arrays on the stack. If you are just targeting GCC, there isn't a whole lot of reason to care.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #4
Microsoft's compiler doesn't like that, no option to enable it either.

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  If - or statement help Jones 12 4,393 Jan 18, 2006 12:12 AM
Last Post: akb825