Using C programing Write an appropriate declaration for each
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?Solution
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
