Hello ladies and gents,
Was wondering if any of you could check this exercise out, I finished it, but, I'm not sure whether Ive got it exactly right, especially the last two definitions.
The exercise is as follows:
- Use typedef to define the types unsigned char, const unsigned char, pointer to integer, pointer to pointer to char, pointer to array of char, array of 7 pointers to int, pointer to an array of 7 pointers to int, and finally, array of 8 arrays of 7 pointers to int.
This is what I have:
include <iostream>
int main() //Use typedef to define the following types
{
typedef unsigned char UChar; //unsigned char
UChar ch = 'a';
std::cout << ch << "\n\n";
typedef const unsigned char CUChar; //const unsigned char
CUChar cch = 'b';
std::cout << cch << "\n\n";
int myInt = 0;
typedef int *pINT; //pointer to integer
pINT pI = &myInt;
std::cout << &myInt << " == " << pI << "\n\n";
typedef char **ppCHAR; //pointer to pointer to char
typedef char *mychArr[]; //pointer to array of char
typedef int *apINT[7]; //array of 7 pointers to int
typedef int **ppMYARRAY[7]; //pointer to an array of 7 pointers to int
typedef int *pMYARRARR[8][7]; //array of 8 arrays of 7 pointers to int
std::cin.get();
return 0;
}