Using C programing Write an appropriate declaration for each of the following si
ID: 3785377 • Letter: U
Question
Using C programing
Write an appropriate declaration for each of the following situations involving pointers Declare a function that accepts an argument which is a pointer to an integer quantity and returns a character. Declare a function that accepts an argument which is an integer a and returns a character. A C program contains the following declaration. static char color [6] ("red", "green", "blue white black' "yellow"); What is the meaning of color? What is the meaning of (color 2)? What is the value of *color? What is the value of *(color 2)? How do color [5] and *(color 5) differ?Explanation / Answer
1) a
char func(int *a)
{
return 'z'; // any char
}
b)
char func(int *a[])
{
return 'z';
}
2)
a)
color is pointer to array
i.e. color[0] will hold red
color[1] will hold green
b)
(color+2) will hold address of blue
c)
*color will give red
d)
*(color+2) will give blue
e)
*(color+5) will give yellow
color[5] will five yellow
both are same
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.