I want to take in a single character of input that the user types in, and then print it back out using the printf() and fgets() methods (this is all a part of a bigger program, but this is the isolated problem).
printf("Please enter the minimum value the random number can be: ");
fgets(input, sizeof(input), stdin);
C11, chapter 220.127.116.11,
fgets() synopsis and description, (emphasis mine)
char *fgets(char * restrict s, int n, FILE * restrict stream);
fgetsfunction reads at most one less than the number of characters specified by
nfrom the stream pointed to by stream into the array pointed to by
and regarding the reason behind one less,
[...] A null character is written immediately after the last character read into the array.
In your case, the value of
n supplied is
fgets() actually does not read anything!!
Solution: You need to change your array size two 2, one element for the input and one element for the terminating null.