C programming, beginner level. Input from the user. Write a C program to do the
ID: 3734817 • Letter: C
Question
C programming, beginner level. Input from the user. Write a C program to do the following with POINTER: 1) Declare an array of pointers named alpha of 17 components of type int. 2) Output the value of the 12th component of the alpha. 3) Set the value of the 5th component of the alpha to 35. 4) Set the value of the 9th component of the alpha to the sum of the 6th and 13th components of the alpha. 5) Set the value of the 4th component of the alpha to three times the value of the 8th component minus 57. 6) Output alpha so that five components appear on each line.
Expert Answer
Explanation / Answer
a. Declare an array alpha of 17 components of type int.
int alpha[17];
b. Output the value of the 12th component of the alpha array.
printf("%d",alpha[11]);
c. Set the value of the 5th component of the alpha array to 35.
alpha[4] = 35;
d. Set the value of the 9th component of the alpha array to the sum of the 6th and
13th components of the alpha array.
alpha[8] = alpha[5] + alpha[12];
e. Set the value of the 4th component of the alpha array to three times the value of the 8th component minus 57.
alpha[3] = 3*alpha[7] - 57;
f. Output alpha so that five components appear on each line.
for(int i=0; i<15; i++)
{
if(i%5 ==0)
printf(" ");
printf("%d",alpha[i]);
}
Thanks, let me know if there is any concern.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.