title: Scanning floats and ints as a string in C
body: <pre><code>#include &lt;stdio.h&gt;
  #define MAX_SIZE 20
  
  int main()
  {
    int age;
    char name[MAX_SIZE];
    float wage;
  
    printf("input name, age and wage: ");
  
    scanf("%s %s %s", name, &amp;age, &amp;wage); //LINE 10
  }
  </code></pre>
  
  <p>after trying to compile:</p>
  
  <pre><code>lab4q5.c: In function 'main':
  lab4q5.c:10: warning: format '%s' expects type 'char *', but argument 3 has type 'int*'
  lab4q5.c:10: warning: format '%s' expects type 'char *', but argument 4 has type 'float *'
  lab4q5.c:16: warning: control reaches end of non-void function
  </code></pre>
  
  <p>Im new to C programming and want to scan a <code>float</code> and <code>int</code> but as a String for one of my labs. I know i can change the <code>%s %s</code> to <code>%f %d</code> and it should compile fine, but I'm being asked to scan if as a <code>%s</code>, any help would be much appreciated:
  the part of the question I'm having trouble with is below: </p>
  
  <blockquote>
    <p>use loop to read inputs (from standard in), one input per line, about
    the user information in the form of name age wage, where age is an
    integer literal, and wage is a floating point literal with up to 2
    decimal number.  • use scanf(“%s %s %s”, name, age, wage) to read in
    three input ‘strings’;</p>
  </blockquote>
  
  <p>so after reading the comments ive decided to format them as strings and then worry about manipulating them as int and float later, this is what I have so far:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define MAX_SIZE 20
  #define MAX_AGE 3
  int isXX(char name[])
  {
  if (name[0] == 'X' &amp;&amp; name[1] == 'X' &amp;&amp; name[2] == '\0')
  return 0; //return return false to quit
  else 
  return 1; //return true 
  }
  
  int main()
  {
  
  char age[MAX_AGE];
  char wage[MAX_SIZE];
  char name[MAX_SIZE];
  
  printf("input name, age and wage: ");//enter name as XX to quit
  scanf("%s %s %s", name, age, wage);
      while(isXX(name[])) // //LINE 22
      {
          printf("input name, age and wage: ");//enter name as XX to quit 
          scanf("%s %s %s", name, age, wage);
      }
  return 0;
  }
  </code></pre>
  
  <p>now im not sure why im getting this error in compiler but i am</p>
  
  <pre><code>lab4q5.c: In function âmainâ:
  lab4q5.c:22: error: expected expression before â]â token
  </code></pre>