Tool/software: Code Composer Studio
Hi,
I wrote the following piece of code today on CCS:
#include <msp430.h>
void Call_This_Func(int len)
{
int array[len];
array[0] = {0};//Code exits this function abruptly and goes to infinite for loop in exit.c file after alloc.cpp file
}
void main()
{
Call_This_Func(10);
while(1);
}
The code abruptly exits the function and main jumps straight to exit.c file (after going in alloc.cpp file).
I understand that this might be due to allocation issues but couldn't understand why it should be a run time error if value passed is legit?
Could someone explain why this is happening?
Also, I would like to have some expert opinions on: is this a acceptable way to create arrays ? If not, then what may be the a better approach?