3 ms·
How so? Do you mind giving an example of a printf like function that needs variable length arrays?
by kevinnk 14y ago
How so? Do you mind giving an example of a printf like function that needs variable length arrays?
- binarycrusader 14y agoI wouldn't call it a "need", more like "occasionally desirable". The short version is that it's a convenient method of letting the compiler handle resource management when you have a variable number of values and sufficient stack space. As others pointed out, it's particularly handy for multi-dimensional arrays. There are also some possible applications here: http://gustedt.wordpress.com/2011/01/13/vla-as-function-arguments/ http://gustedt.wordpress.com/2011/01/13/vla-as-function-argu... In fairness, I've used them only rarely, but those few times I've used them have saved me a bit of grief. I could easily live without them if required...