L1 void func1(){ ... /* func code */ }
L2 void func2(){ ... /* func code */ }
L3 uint32 array[3]= {0}; /* typedef unsigned int uint32*/
L4 int main(){
L5 array[0] = 0x12345678;
L6 array[1] = (uint32)&func1;
L7 array[2] = (uint32)&func2;
L8 }
The above code (Line 6 & 7) successfully casts the address of func1 and func2 in 32 bit and saves it at the desired index.
The compiler throws an error that "expression must have arithmetic type" when I try to initialize the array outside the function (see line 3 in the following code).
L1 void func1(){ ... /* func code */ }
L2 void func2(){ ... /* func code */ }
L3 uint32 array[3] = { 0x12345678, (uint32)&func1, (uint32)&func1 };