title: Assign a variable to an array position [C]
body: <p>I'm starting to code, and I've been scratching my head for a while now. How can I assing a variable to an array position?</p>
  
  <p>I want the user to insert the A, B, C and D, and then store the values as vectors, so I can operate with the line slope later.</p>
  
  <pre><code>int a, b, c, d, e, f, g, h;
  int AB, CD, AC, BD;
  
  printf("\n\n  A ___________________ B");
  printf("\n   |                   |    ");
  printf("\n   |                   |    ");
  printf("\n   |                   |    ");
  printf("\n   |                   |    ");
  printf("\n   |___________________|    ");
  printf("\n  C                     D    ");
  printf("\n\n\nA(a, b):");
  printf("\n-&gt; ");
  scanf("%d", &amp;a);
  printf("\n-&gt; ");
  scanf("%d", &amp;b);
  printf("\n\nB(c, d): ");
  printf("\n-&gt; ");
  scanf("%d", &amp;c);
  printf("\n-&gt; ");
  scanf("%d", &amp;d);
  printf("\n\nC(e, f): ");
  printf("\n-&gt; ");
  scanf("%d", &amp;e);
  printf("\n-&gt; ");
  scanf("%d", &amp;f);
  printf("\n\nD(g, h): ");
  printf("\n-&gt; ");
  scanf("%d", &amp;g);
  printf("\n-&gt; ");
  scanf("%d", &amp;h);
  
  printf("\n\nA = (%d, %d)", a, b);
  printf("\n\nB = (%d, %d)", c, d);
  printf("\n\nC = (%d, %d)", e, f);
  printf("\n\nD = (%d, %d)", g, h);
  
  //VECTOR AB
  AB[0]=c-a;
  AB[1]=d-b;
  
  //VECTOR CD
  CD[0]=g-e;
  CD[1]=h-f;
  
  //VECTOR AC
  AC[0]=e-a;
  AC[1]=f-b;
  
  //VECTOR BD
  BD[0]=g-c;
  BD[1]=h-d;
  </code></pre>
  
  <p>The last part of that code does not work, so I assume I can't assign the variables just like that. What can I do to make this work?</p>
  
  <p>Thanks a lot!</p>