c - Change non-modifiability of an array by using a structure -


from kerrek sb's comment on why can't modifiable lvalue have array type?

you can trivially assign arrays making them members of struct , assigning lvalues.

what mean? mean if structure has array member, array member can modifiable? following example doesn't work:

i define struct type member being array

typedef struct { int arr[3];} mytype; 

then

mytype mystruct; mystruct.arr = (int[]) {3,2,1}; 

and got error: assignment expression array type.

no, means if assign instance of struct 1 in example struct assigning arrays.

struct array {     int array[3]; };  struct array a; struct array b = {{0, 1, 2}}; // chris dodd // valid! = b; 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -