0

I'm trying to assign an enum so that the user enters in a small string (e.g. B6) and I want to assign a number value to that.

My code:

typedef enum{
    A8 = 11, B8, C8, D8...
    A7 = 21, B7, C7, D7...
    ...
} rankFile;

Then I'm trying to scan for user input like

rankFile userInput;
scanf("%u", &userInput);
printf("%d", userInput);

I'm getting garbage values, e.g. 2 billion or sometimes a negative number. Does anyone know what I can do to fix this?

Matthew Kerian
  • 812
  • 5
  • 18

0 Answers0