On Wed 2008-10-15 09:22:42 UTC+0530, Swamy SRK ([EMAIL PROTECTED]) wrote:
> 5: short age[4];
> 6: short same_age[4];
> 7: age[0]=23;
> 8: age[1]=34;
> 9: age[2]=65;
> 10: age[3]=74;
> 11:
> 12: same_age=age; --> Array copying
> Array copying is done in line number 12. Is this allowed in C++? I did
> googling, got few answers saying "No". Sending it to group for
> confirmation.
No.
test.cpp:12: error: ISO C++ forbids assignment of arrays
Since both arrays are the same size you can use memcpy:
memcpy(same_age, age, sizeof same_age);
Or just write a loop:
for (i = 0; i < 4; i++)
{
same_age[i] = age[i];
}