-
Function call
I have a question about calling a function from within an if statement.
The prototype of the function is as follows:
BOOKPTR BOOKSEARCH(BOOKPTR, int, int);
The function call is as follows:
if (mat = 1 && ITEM_ID != NULL)
{
BOOKPTR BOOKSEARCH(BOOKPTR BHead, int ITEM_ID, int mat);
}
and the function definition is as such:
BOOKPTR BOOKSEARCH(BOOKPTR BHead, int num, int mat)
{
. . .
When I run the program, it just skips over the function call. The debugger hits the opening brace and then the closing brace and goes on to execute the else if statement Can anyone tell me why??
-
From what you have said, I believe the function call should look more like the following:
if (mat = 1 && ITEM_ID != NULL)
{
BOOKPTR x = BOOKSEARCH(BHead, ITEM_ID, mat);
}
-
if (mat = 1 && ITEM_ID != NULL)
{
BOOKPTR BOOKSEARCH(BOOKPTR BHead, int ITEM_ID, int mat);
}
if you really wrote the above in your program and it compiled , its time you got a decent complier .
ftp://ftp.xraylith.wisc.edu/pub/khan...32/gcc-2.95.2/
-
> if (mat = 1 && ITEM_ID != NULL)
if (mat == 1 && ITEM_ID != NULL)