Is it alright to use a pointer like this in an if else statement?
if ((*tPtr) < GRADE_D)
*cGPtr = "D";
assuming that GRADE_D is a data which has been defined with #define
I get an error where thye tell me that "=" is missing.
Is it alright to use a pointer like this in an if else statement?
if ((*tPtr) < GRADE_D)
*cGPtr = "D";
assuming that GRADE_D is a data which has been defined with #define
I get an error where thye tell me that "=" is missing.
Only by the cross are you saved...
if GRADE_D is a charater and tPtr points to a character then the if statement is fine. (note that 'D' is a character and "D" is a string). The next line looks dubious... did you mean:
*cGPtr = 'D';
?
DavT
-----------------------------------------------
er...actually
GRADE_D was defined as an integer, e.g. 50
whereas *tPtr was defined as a double type pointer, which contains an address to a double value.
the error message with this is
error C2143: syntax error : missing ')' before ';'
and
error C2059: syntax error : ')'
the line i have now looks like this :
if (*tPtr < GRADE_D)
*cGPtr = 'D';
Only by the cross are you saved...
also, if i replace the GRADE_D with a directly written integer like 50 or 88, it works...
seems like there's a problem with the #define thing
but i defined it correctly like
#define GRADE_D 50;
Only by the cross are you saved...
> #define GRADE_D 50;
Replace the semicolon at the end, because #define is a preprocessor directive and doesn't need ";" at the end.
hey thanx man! that worked for me!
Only by the cross are you saved...