Question: (8 points) The following program is supposed to add two numbers to obtain the sum... but it does not work due to errors. How
(8 points) The following program is supposed to add two numbers to obtain the sum... but it does not work due to errors. How do you propose to fix the errors in the program so that variable "Result" will get the correct sum loaded into it by the time the program reaches the while(1) idle loop? Write the corrected line(s) of code for any line that needs to be modified. You can check your solution by using MPLAB Simulator. [Please clearly indicate corrections] (Hint: you will have to add "*" and "&" symbols to the code below, where * => "the value pointed at by...", and & => "the address of..." Please consult the "EssentialC.pdf" document to read about pointers.) void calculation (int N1, int N2, int *sum) { sum = N1 N2; } void main() { } int Numberl, Number2, Result; Number1 150; Number2 = 415; calculation (Result, Numberl, Number2); while (1);
Step by Step Solution
There are 3 Steps involved in it
The provided code snippet contains an error that prevents the variable Result from storing the corre... View full answer
Get step-by-step solutions from verified subject matter experts
