Question: Answer these questions using C program by Visual Studio: a) The following code is to input 10 elements in the array and then print out

Answer these questions using C program by Visual Studio:

a) The following code is to input 10 elements in the array and then print out those values. Anything wrong with this program? Please indentify and fix it.

int main ( )

{

int *p, i, a [10];

p = a;

for (i =0; i < 10; i++)

scanf ("%d", p++);

printf (" ");

for (i = 0; i < 10; i++)

printf ("a[%d]=%d ", i, *p++);

return 0;

}

b) Please use pointers to write a program that finds the maximum and minimum values of an array with 10 elements

(e.g., int a [10] = {12, 34, 61, 100, 87, 56, 73,100, 29, 3};)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!