It is a GCC extension that the current MSVC does not support. You can replace it in MSVC fairly easily with an _alloca (a stack allocation that requires no manual deallocation on the part of the programmer):
#include
...
int *k = (int *)_alloca(sizeof(*k)*r);