title: How to create a string-type variable in C
body: <p><strong>Question</strong></p>
  
  <p>How to declare a string variable in C?</p>
  
  <p><strong>Background</strong></p>
  
  <p>In my quest to learn the basics of <a href="/questions/tagged/c" class="post-tag" title="show questions tagged 'c'" rel="tag">c</a>, I am trying to port one of my oldest <a href="/questions/tagged/python" class="post-tag" title="show questions tagged 'python'" rel="tag">python</a> programs, <code>Bob</code>, to C. In the program, the script asks the user for information on him or herself, and then spits out responses. Almost all of these variables use <code>raw_input</code> for their information - the variables are strings. But, I have found no way to declare C variables.</p>
  
  <p><strong>Code</strong></p>
  
  <p>So far, I have tried to declare the variable as of type <code>char</code> and <code>int.</code> Here is the code, switch the type at your leisure. </p>
  
  <pre><code>int main(int argc, const char * argv[])
  {
  
      int name;
      printf("What is your name?");
      scanf("%s",&amp;name);
      printf("Your name is %s", name );
  
      return 0;
  }
  </code></pre>
  
  <p><strong>Error Message</strong></p>
  
  <p>When I run this code, <code>Xcode</code> returns some weird stuff. This part of the globidty-gloop is highlighted.</p>
  
  <pre><code>0x7fff96d2b4f0:  pcmpeqb(%rdi), %xmm0
  </code></pre>
  
  <p>Lasty, <a href="http://answers.yahoo.com/question/index?qid=20080715104545AA4uejN" rel="noreferrer">this Yahoo Answer</a> said that I had to use something called a <code>character array</code>. It was posted 5 years ago, so I assumed that there was a better way.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I am following the tutorial at <a href="http://www.cprogramming.com/tutorial/c-tutorial.html" rel="noreferrer">C Programming</a>.</p>