KallaANaidu
Member
Dear All,
I want to develop a minor C Business Function for operation/production between 2 numbers, based on the parameter which gives 'type of operation/product' as input.
I developed a minor C business function which is used to do operation between 2 numbers.
Data structure has 4 parameters. 3 are input parameters other one is output parameter.
Requirement:
Parameter 1_ Input (any number can be passed)
Parameter 2_Input (any number can be passed)
Parameter 3_Input (type of operation)
Parameter 4_Output. (result)
If I pass 1 through parameter 3, addition cab be done.
If it is 2, subtraction can be done.
If it is 3, multiplication can be done.
If it is 4, division cab be done.
I have already done, passing numbers. Now I want to know how to pass the symbols like +, - , *, /.
So how to do comparison in C code.
Example:
If type of operation == + (I want to know this, how to compare. )
Result = Parameter 1+ Parameter 2
Thanks in advance.
I want to develop a minor C Business Function for operation/production between 2 numbers, based on the parameter which gives 'type of operation/product' as input.
I developed a minor C business function which is used to do operation between 2 numbers.
Data structure has 4 parameters. 3 are input parameters other one is output parameter.
Requirement:
Parameter 1_ Input (any number can be passed)
Parameter 2_Input (any number can be passed)
Parameter 3_Input (type of operation)
Parameter 4_Output. (result)
If I pass 1 through parameter 3, addition cab be done.
If it is 2, subtraction can be done.
If it is 3, multiplication can be done.
If it is 4, division cab be done.
I have already done, passing numbers. Now I want to know how to pass the symbols like +, - , *, /.
So how to do comparison in C code.
Example:
If type of operation == + (I want to know this, how to compare. )
Result = Parameter 1+ Parameter 2
Thanks in advance.