Saturday, May 22, 2010

How can you perform the addition of 2 numbers in 'c' using just 1 variable?

Not sure exactly what you mean by that but you can always put the first number into a variable and then just add the second number as a constant.





int number = 5;


.


.


.


number += 7;





the number will now equal 12.





You could return the number from a function





number += get_next_number();





where get_next_number() is a function reading a number from somewhere and returning it.





You could use #defines





There are probably many ways.

How can you perform the addition of 2 numbers in 'c' using just 1 variable?
I think you need to clafity your question.





By c do you mean the complex numbers?


No comments:

Post a Comment