Can someone help me on this i have no clue on how i should start this... I get this from one of my friend in college and I'm trying to learn it
Finish writing the definition for Value(), as described below. Your function should NOT do input or output. Don?t be concerned about results being too large or too negative (causing overflow), but DO be concerned about the possibility of division by zero.
#include <stdio.h>
struct Expression{
int a;
char op;
int b;
};
typedef struct Expression EXPRESSION;
// Function prototype
int Value(EXPRESSION expr);
int main(void)
{
EXPRESSION expr1 = {3, ?*?, 7};
int result = Value(expr1);
printf("Result is %d\n.", result};
return 0;
}
//----------------------------------------------------------------------------
// Calculates and returns the value of an arithmetic expression of the form
// a op b, where a and b are int values, and op can be one of ?+?, ?-?, ?*?,
// or ?/?. Each struct instance holds the numbers of the expression as well as // the operator for the expression.
//----------------------------------------------------------------------------
int Value(EXPRESSION expr)
{
Question
atyemail
Can someone help me on this i have no clue on how i should start this... I get this from one of my friend in college and I'm trying to learn it
Finish writing the definition for Value(), as described below. Your function should NOT do input or output. Don?t be concerned about results being too large or too negative (causing overflow), but DO be concerned about the possibility of division by zero.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts