title: C Structures Bus Error 10
body: <p>I have a stuct in C, and I use a function to get the values for the structure from the user. Below is my structure.</p>
  
  <pre><code>typedef struct {
      char    *name;
      char    *chemical_symbol;
      char    *class;
      int     atomic_number;
      double  atomic_weight;
      int     *electrons;
  } element_t;
  </code></pre>
  
  <p>This is the function I am using to get the values from the user. The problem lies in this function after asking for the chemical symbol. I get Bus Error: 10. My understanding of a bus error is when the processor cant attempt the memory access. Any help is appreciated. Thank you!</p>
  
  <pre><code>element_t scan_element() {
  
      element_t element;
  
      printf ("Enter New Element Information:\n\n");
  
      printf("Element Name: ");
      scanf("%s", element.name);
  
      printf("Element Chemical Symbol: ");
      scanf("%s", element.chemical_symbol);
  
      printf("Element Class: ");
      scanf("%s", element.class);
  
      printf("Element Atomic Number: ");
      scanf("%d", &amp;element.atomic_number);
  
      printf("Element Atomic Weight: ");
      scanf("%lf", &amp;element.atmoic_weight);
  
      printf("Element Electrons: ");
      scanf("%p", &amp;element.electrons);
  
      return(element);
  }
  </code></pre>