expected expression before ‘{‘ token

The error is because you can’t assign an array that way, that only works to initialize it.

int arr[4] = {0}; // this works
int arr2[4];

arr2 = {0};// this doesn't and will cause an error

arr2[0] = 0; // that's OK
memset(arr2, 0, 4*sizeof(int)); // that is too

So applying this to your specific example:

struct sdram_timing scan_list[30];
scan_list[0].wrdtr = 0;
scan_list[0].clktr = 0;

or you could use memset the same way, but instead of sizeof(int) you need size of your structure. That doesn’t always work… but given your structure, it will.

Leave a Comment