Skip to main content
Copy edited. Reformatted the sample code.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134
 #define array_size 10 struct {     int16 size;     int16 array[array_size];     int16 property1[(array_size/16)+1]     int16 property2[(array_size/16)+1]   }array1= array1 = {array_size, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; #undef array_size 

array_size is assingpassing to the size variable:

#define array_size 30 struct {    int16 size;    int16 array[array_size];    int16 property1[(array_size/16)+1]    int16 property2[(array_size/16)+1]   }array2= array2 = {array_size}; #undef array_size 

usageUsage is  :

void main() {  int16 size =array1= array1.size;    for (int i=0; i!=size;i++=size; i++) {   array1.array[i]*=2; array[i] *= 2;  }   } 
 #define array_size 10 struct {   int16 size;   int16 array[array_size];   int16 property1[(array_size/16)+1]   int16 property2[(array_size/16)+1]   }array1={array_size,0,1,2,3,4,5,6,7,8,9}; #undef array_size 

array_size is assing to size variable

#define array_size 30 struct {   int16 size;   int16 array[array_size];   int16 property1[(array_size/16)+1]   int16 property2[(array_size/16)+1]   }array2={array_size}; #undef array_size 

usage is  :

void main(){ int16 size =array1.size;   for (int i=0; i!=size;i++){ array1.array[i]*=2;  }   } 
 #define array_size 10 struct {   int16 size;   int16 array[array_size];   int16 property1[(array_size/16)+1]   int16 property2[(array_size/16)+1] } array1 = {array_size, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; #undef array_size 

array_size is passing to the size variable:

#define array_size 30 struct {  int16 size;  int16 array[array_size];  int16 property1[(array_size/16)+1]  int16 property2[(array_size/16)+1] } array2 = {array_size}; #undef array_size 

Usage is:

void main() {  int16 size = array1.size;  for (int i=0; i!=size; i++) {   array1.array[i] *= 2;  } } 
deleted 11 characters in body
Source Link
 #define array_size 10 struct { int16 size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array1={array_size,0,1,2,3,4,5,6,7,8,9}; #undef array_size 

array_size is assing to size variable

#define array_size 30 struct { int16 size=array_size;size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array2={array_size}; #undef array_size 

usage is :

void main(){ int16 size =array1.size; for (int i=0; i!=size;i++){ array1.array[i]*=2; } } 
 #define array_size 10 struct { int16 size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array1={array_size,0,1,2,3,4,5,6,7,8,9}; #undef array_size 

array_size is assing to size variable

#define array_size 30 struct { int16 size=array_size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array2={array_size}; #undef array_size 

usage is :

void main(){ int16 size =array1.size; for (int i=0; i!=size;i++){ array1.array[i]*=2; } } 
 #define array_size 10 struct { int16 size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array1={array_size,0,1,2,3,4,5,6,7,8,9}; #undef array_size 

array_size is assing to size variable

#define array_size 30 struct { int16 size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array2={array_size}; #undef array_size 

usage is :

void main(){ int16 size =array1.size; for (int i=0; i!=size;i++){ array1.array[i]*=2; } } 
Source Link

 #define array_size 10 struct { int16 size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array1={array_size,0,1,2,3,4,5,6,7,8,9}; #undef array_size 

array_size is assing to size variable

#define array_size 30 struct { int16 size=array_size; int16 array[array_size]; int16 property1[(array_size/16)+1] int16 property2[(array_size/16)+1] }array2={array_size}; #undef array_size 

usage is :

void main(){ int16 size =array1.size; for (int i=0; i!=size;i++){ array1.array[i]*=2; } }