Uploaded by abdullah atif

Assignment

advertisement
CSE109
Assignment
Please see the program below#include <stdio.h>
int* takeArrayInput(int n)
{
int a[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
return a;
}
void printArray(int *a, int n)
{
printf("Printing...\n");
for (int i = 0; i < n; i++) {
printf("%d ", a[i]);
}
printf("\n");
}
int main()
{
int n;
printf("Enter the number: ");
scanf("%d", &n);
int *a = takeArrayInput(n);
printArray(a, n);
return 0;
}
Now, for the input
10
56 89 35 76 55 65 78 34 69 33
predict and write down the output of the program without running it. Then, run the program
and write down the output of the program. If there is any issue in this program write down the
proper reason for the issue then write down the correct version of the code and output of the
program.
Instructions:
1. Write your answer in a text file and submit it to the teams.
2. Do not copy. -20 mark for copy. No mercy this time.
3. Give a proper explanation.
Download