Q:

Scanf-reading variables which have to meet ceratin specifications

I have to solve an exercise which at first glance seemed really simple to me. However, I am not so sure how to solve it. Given the fact that variables a and b have certain admissable values, should I verify whether they are in the correct range after reading them? And regarding variable b, in the examples it is given in scientific notation, so should I read it using the e specifier? And last but not least, the assignment supression of ',' is done using "%*[,]"? 

Write a set of statements to read from the standard input three variables a, b and c, where the variables have the following types: 
a – unsigned short integer, b – float, c – string of at most 31 characters
The input values are separated by one comma. The first variable is given as an octal number. The admissible values for a and b are as follows:
-4331 < a <= 28731
-1035 < b < 9749273 

Suitable error messages should be given if the values are not within the allowed range or in the wrong format. Sample input: 
12745, -1.e-3, Is this a good one? 

0xEE04F, 21e75, Maybe this one... 

70073, 21e+6, Or this one. Could this string be too long to put into allocated area?

A:

OP: should I verify whether they are in the correct range after reading them?
A: Yes.  The scanning will check gross range error.  Then code checks local range.
OP: read it using the e specifier?
A: a, e, f, g are all equivalent in scanf() family.  So use what seems appropriate: e is good.
OP: the assignment suppression of ',' is done using "%*[,]"
A: Almost: One could use "%*1[,]", but "," is sufficient.
Use fgets() and sscanf() and then check range.
char buf[1000];
if (fgets(buf, sizeof buf, stdin) == NULL) {
  handle_EOF_or_IOError();
}
short Number;
float x;
char s[31+1];
if (3 != sscanf(buf, "%ho,%e, %31[^\n]", &Number, &x, s)) {
  handle_ParseError();
}
short NumberTooSmall = -4331;
short NumberMax = 28731
float xTooSmall = -1035.0f;
float xTooBig = 9749273.0f;
if ((Number <= NumberTooSmall) || (Number > NumberMax) ||
    (x <= xTooSmall) || (x >= xTooBig)) {
  handle_RangeError();
}

Note: there is a subtle issue on when the parsed string begin in "12745, -1.e-3, Is this a good one?", etc.  OP says that , is the seperator.  This implies the string starts with " Is this ...".  I think the OP wants to skip leading spaces and get "Is this ...".
Assuming IEEE binary32 for float, 9749273.0 needs 24 bits to represent exactly.  Since this format has 23+1 bits of precision for normal numbers, all is well.  Care should be observed with range testing of floating point values.  

