title: Initialize a struct in C
body: <p>What I want to do is simply initialize a instance of a struct. The struct is defined here:</p>
  
  <pre><code>typedef struct Rectangle 
  {
  tName Name; /* name of the rectangle */
  struct Rectangle * binSon[2];
  int Center[2];
  int Length[2]; /* distance to the boarder of the rectangle */
  int Label;
  }Rectangle;
  </code></pre>
  
  <p>and how I initialized it is like below:</p>
  
  <pre><code>Rectangle * binSon[2];
  binSon[0] = NULL;
  binSon[1] = NULL;
  
  int Center[2];  
  int Length[2];
  
  Center[0] = 0;
  Center[1] = 0;
  Length[0] = 5;
  Length[1] = 5;
  
  Rectangle world = {"World", binSon, Center, Length, 0};
  </code></pre>
  
  <p>at the last line, when I compile the program, it reports me an warning of:</p>
  
  <pre><code>mx_cif_ds_manager.c:52:2: warning: initialization makes integer from pointer without a cast [enabled by default]
  mx_cif_ds_manager.c:52:2: warning: (near initialization for 'world.Name[0]') [enabled by default]
  mx_cif_ds_manager.c:52:2: warning: initialization makes integer from pointer without a cast [enabled by default]
  mx_cif_ds_manager.c:52:2: warning: (near initialization for 'world.Name[1]') [enabled by default]
  mx_cif_ds_manager.c:52:2: warning: initialization makes integer from pointer without a cast [enabled by default]
  mx_cif_ds_manager.c:52:2: warning: (near initialization for 'world.Name[2]') [enabled by default]
  mx_cif_ds_manager.c:52:2: warning: initialization makes integer from pointer without a cast [enabled by default]
  mx_cif_ds_manager.c:52:2: warning: (near initialization for 'world.Name[3]') [enabled by default]
  </code></pre>
  
  <p>Not sure what's going wrong with this piece of program, and wondering if any one has any idea or suggestion that can help me improve this piece of code. Whats a more gental way to initialize a struct?</p>
  
  <p>Thank you</p>
  
  <p>======UPDATE======</p>
  
  <p>Thank you for your help, but what if I want to use variables to initialize a struct. Do I have to malloc a memory space in this case?</p>
  
  <p>The tName definition is here</p>
  
  <pre><code>typedef char tName[MAX_NAME_LEN + 1];
  </code></pre>