- #1
ineedmunchies
- 45
- 0
Homework Statement
Write a C program to use a function to add two 16bit and two 32bit integers together and return a long integer result.
Call the function twice with different parameters and print the results.
Declare your input variables to one of the function calls as local variables (on the stack) and the other as global variables
Homework Equations
The Attempt at a Solution
Ok so my first problem is the interpretation of the question. Should I add two 16bit numbers, then add the two 32bit numbers, or do I add them all together? Its a little bit confusing.
Calling the function twice would be no problem for me, if I was to declare the variables locally they could be input when the function is called. Or if i was to declare the variables globally then I could just add the variables by referencing their name in the function. But it is doing both of these things with one function that has left me stuck. Anybody any ideas or starting points? Thank you in advance