iDevGames Forums
Is this statement okay? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Is this statement okay? (/thread-1366.html)



Is this statement okay? - NelsonMandella - Apr 30, 2009 12:33 PM

Would this be considered kosher in C?

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

}


Is this statement okay? - maximile - Apr 30, 2009 12:39 PM

I think that's allowed in C99.


Is this statement okay? - Skorche - Apr 30, 2009 01:11 PM

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.


Is this statement okay? - Najdorf - Apr 30, 2009 03:07 PM

Microsoft's compiler doesn't like that, no option to enable it either.