unassigned-variable

Assigned a value that is never used (simple program)


#include <stdio.h>
#include <conio.h>
int main ()
{
  int numc;
  puts ("NUMBER PLEASE");
  numc=getchar();
  printf ("%d");
  getch ();
  return 0;
}

I get the warning numc is assigned a value that is never used, while I'm trying to get the value. Please help.


Solution

  • Did you mean:

    printf ("%d", numc);
    

    ? That would use the value the the compiler is warning you about.