With the following statement, write a program to output the value of each pointer variable and the value of pointer variable + 1. Submit the output of the program, instead of the program you wrote. For example, cout << (int *)pChar <<"\t" << (int *)(pChar+1) << endl; or printf("%p\t%p\n", pChar, pChar+1); char ch; int size; double price; int arr[5]; char *pChar = &ch; int *pInt = &size; double *pDbl = &price; int (*pArr)[5] = &arr;
时间: 2024-03-26 16:35:43 浏览: 70
I'm sorry, but as an AI language model, I don't have the capability to run programs and output their results. However, I can explain how to obtain the values of each pointer variable and the value of pointer variable + 1.
To obtain the value of a pointer variable, you can simply print out the value of the pointer using the dereference operator (*) before the pointer variable name. For example, to obtain the value of pChar, you can use:
```
cout << *pChar << endl;
```
To obtain the value of pointer variable + 1, you can simply add 1 to the pointer variable and print out its value. For example, to obtain the value of pChar + 1, you can use:
```
cout << *(pChar + 1) << endl;
```
Similarly, you can obtain the values of the other pointer variables in the program.
阅读全文