Explain why the above outputs are the same or different from
Explain why the above outputs are the same or different from each other. Consider the following program and answer the questions below. include int main(int argc, char * argv[]) {int *p1; char *p2; p2 = p1; return 8; return 8;} What does variable p2 represent? Will this program successfully compile without warnings? Why or why not? (Try it!) Now let\'s look at the relationship between pointer notation and array notation. Compile and run the following program and answer the corresponding questions. #include int main(void) {int array_of_integers[10], *ptr_of_array, *ptr_of_first_element; int I; ptr_of_array = array_of_integers; ptr_of_first_element = &array;_of_integers[8]; for(i = 0; i
Solution
The Given program executes successfully without showing any warnings or errors.
#include <stdio.h>
int main(int argc, char *argv[]) {
int *p1;
char *p2;
p2=p1;
return 0;
}
Because here p1 and p2 are different datatypes but *p1 and *p2 represents pointer to a variable.
