Email debug1.c, debug2.c and debug3.c as attachments once each passes both compile and run tests. Due Monday midnight 9/15.
Debugging Read through the following two programs and mark any mistakes you find. Then rewrite each of the lines of code, correcting the mistakes. (21 errors)
| Program 1 | |
#inculde <stdio.h |
__________________________________________________ |
in main () | __________________________________________________ |
int minuend, subtrahend; | __________________________________________________ |
int difference; | __________________________________________________ |
minuend = 37 | __________________________________________________ |
subtrahend == 8; | __________________________________________________ |
differance=minuend-subtrahend; | __________________________________________________ |
print ("%d - %c = %d\n" minuend,
| __________________________________________________ |
return 0; | __________________________________________________ |
} | __________________________________________________ |
| Program 2 | |
#include <studio.h> |
__________________________________________________ |
int main { | __________________________________________________ |
int i; | __________________________________________________ |
for (i=0, i < 5, i+ { | __________________________________________________ |
printf ("HI!\n) | __________________________________________________ |
| __________________________________________________ |
} | __________________________________________________ |
| Program 3 | __________________________________________________ |
|
#include <stdio.h>#include <stdlib.h> | __________________________________________________ |
| int main ( int argc, char *argv[ ] ) { | __________________________________________________ |
| int minuend, subtrahend; | __________________________________________________ |
| if (argc < 2) { | __________________________________________________ |
| __________________________________________________ |
| __________________________________________________ |
| } | __________________________________________________ |
| minuend = atoi(argv[1]); | __________________________________________________ |
| subtrahend = atoi(argv[2]); | __________________________________________________ |
| printf("%d - %d = %d\n", minuend, subtrahend, minuend - subtrahend); | __________________________________________________ |
| return EXIT_SUCCESS; | __________________________________________________ |
| } | __________________________________________________ |