Why isn’t it in C (or C++) allowed?
I mean this:
ucell GetPlayerPosPositionData[5];
GetPlayerPosPositionData = {4*sizeof(cell),playerid,0,sizeof(cell),2*sizeof(cell)};//this does not work, error
//normal assignment
GetPlayerPosPositionData[1] = playerid;
GetPlayerPosPositionData[2] = 0;
GetPlayerPosPositionData[3] = sizeof(cell);
GetPlayerPosPositionData[4] = 2*sizeof(cell);
Because the syntax says it is not allowed? There are two parts to the problem:
You can’t use the initializer syntax except in an initializer or (in C99) in a compound literal.
You can’t assign whole arrays.
In C99, you could pass an array to a function:
(Your question is unclear on
cellvsucell; I chose to usecellthroughout.)You still can’t do array assignment. If the array is wrapped in a structure, you can do the structure assignment which, coincidentally, assigns the contained array. But that is a structure assignment, not an array assignment.