I do not understand this two questions and try to fix it on visual studio. Need
ID: 3790989 • Letter: I
Question
I do not understand this two questions and try to fix it on visual studio. Need help?
1. Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code.
2. Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code. Note: Be sure to check the output screen to see if the correct values are displaying according to the output statements.
#include k stdio.h int main() int arr values [3] f 10, 20, 30, 4e for (int count 0; count 3; count++) printf ("%d n'', arrvalues [count]); return 0;Explanation / Answer
1. Some errors were in the code. i have corrected them and correct version of the code is given below with output---->
main1.c
#include <stdio.h>
int main() {
int count;
int arrValues[]= { 10, 20, 30, 40 };
for(count = 0; count < 4; count++) {
printf("%d ", arrValues[count]);
} return 0;
}
Output:-
2. Some errors were in the code. i have corrected them and correct version of the code is given below with output---->
main2.c
#include <stdio.h>
int main() {
int dog[3];
int i;
for (i = 0; i < 3; i++)
{
printf("%d ", dog[i]);
}
return 0;
}
Output:-
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.