+ 1
How can i append more numbers to an array (integer type) in C?
2 Answers
+ 7
By the way, if you define an array with four elements and try to change its fifth element, this will affect whatever is stored at that memory location (which might very well be another, totally unrelated variable of your program). So you might want to avoid that.
+ 2
You can't append elements to an array.They are static data structures, and their elements are allocated in contiguous memory locatios.
To do
a[4] = 7;
You must declare a[] with at least 5 elements:
int a[5]={4,5,6,8};