title: In C, Define a structure type element_t to represent one element from the periodic table of elements
body: <p>I'm writing a code in C and it doesn't give me any errors, but I am not getting the desired result. </p>
  
  <p>Define a structure type element_t to represent one element from the periodic table of elements. Components should include the atomic number (an integer); the name, chemical symbol, and class (strings); a numeric field for the atomic weight; and a seven element array of integers for the number of electrons in each shell. the following are the components of an element_t structure for sodium. 11 sodium Na alkali_metal 22.9898 2 8 1 0 0 0 0 Define and test I/O functions scan_element and print_element.</p>
  
  <p>Once I compile and test the code, this is the output I get
  11   ÿ   sodNa   Na   22.989800   2810000% </p>
  
  <p>as you can see, it does  not give me the the element name or the class of element.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #define ELEM_NAME 15
  #define ELEM_CLASS 20
  #define ELECT 7
  
    typedef struct
    {
      int atom_num;
      char name[ELEM_NAME];
      char symbol[3];
      char class_of_metal [ELEM_CLASS];
      double atomic_weight;
     nt elec[ELECT];
    } element_t;
  
  element_t scan_element();
  
  void print_element(element_t my_element);
  
  element_t
  
  scan_element(); 
  
  int main(void)
  {
  
    int i = 0;
    element_t my_element;
  
    printf("enter the atomic number:\n");
    scanf("%d", &amp;my_element.atom_num);
  
    printf("enter element name:\n");
    scanf("%s", &amp;my_element.name[ELEM_NAME]);
  
    printf("enter symbol:\n");
    scanf("%s", &amp;my_element.symbol[3]);
  
    printf("enter type of metal:");
    scanf("%s", &amp;my_element.class_of_metal[ELEM_CLASS]);
  
    printf("enter atomic weight:");
    scanf("%lf", &amp;my_element.atomic_weight);
  
    printf("enter number of electrons in each shell:");
    scanf("%d", &amp;my_element.elec[ELECT]);
  
   /* output */
      printf("%d   %s   %s   %s   %lf   %d", my_element.atom_num,
                                             my_element.name,
                                             my_element.symbol,
                                             my_element.class_of_metal,
                                             my_element.atomic_weight,
                                             my_element.elec[ELECT]);
  
   return (0);
   }
  </code></pre>