In C++,when I declare an array like int array[10];,it sometimes uses memory assigned to other variable where as this problem is non-existent when I use an integer pointer and malloc to allocate memory to it. Why does this happen?
Why doesn't array declaration guarantee proper memory allocation whereas malloc does?
c++;programming practices