I have a limited knowledge about c++. I tried to compile a c++ library and when I run the make file for the following header file
<
Array are essentially just pointers. C++ (being a symbol based programming language) has its own interpretations for arrays. Meaning:
int* a[3]; you've declared the array, but currently the values assigned to each element is some junk values that were already stored at the memory location allotted to your array.
a={1,2,3}; won't work because: C++ treat the array name 'a' as a pointer pointing at the address location of the 1st element in array. 'a' is basically interpreted by C++ as '&a[0]' which is the address of the element a[0]
So, you have 2 ways to go about assigning values
using array indexing (your only option if you don't know what pointers are)
int a[3]; for(int i=0;i<3;++i) // using for loop to assign every element a value { cin>>a[i]; }
2 treating it as a pointer and using pointer operation
int a[3];
for(int i=0;i<3;++i) // using for loop to assign every element a value
{
cin>>*(a+i); // store value to whatever it points at starting at (a+0) upto (a+2)
}
Note: can't use ++a pointer operation as ++ changes the position of a pointer whereas a+i will not change the location of pointer 'a', and anyways using ++ will give a compiler error.
Recommend reading Stephen Davis C++ for dummies book.