title: c define arrays in struct with different sizes
body: <p>I need to define a struct for two types of objects. Both have exactly the same data structure and perform same tasks (member methods). </p>
  
  <p>The ONLY difference is that the array sizes are different in the two types, one using SIZE_A, the other SIZE_B.</p>
  
  <p>Duplicating the definition of the struct and functions is not wanted.</p>
  
  <p>How could I use one type of 'struct', and initialize its arrays with different sizes?</p>
  
  <pre><code>#define SIZE_A 100
  #define SIZE_B 200
  
  typedef struct{
    int matr[SIZE_A][SIZE_A];  // for another type matr[SIZE_B]
    int arr[SIZE_A];           // for another type arr[SIZE_B]
    int size;                  // will be initialized to SIZE_A or SIZE_B
    int var1, var2;
  }s;
  
  void task1(s* si){
    ...
  }
  
  void task2(s* si){
    ...
  </code></pre>