Question:
Suppose treacle is an array of 10 floats. Declare a pointer that points to the first element of treacle and use the pointer to display the first and last elements of the array.Answer:
float * pf = treacle; // or = &treacle[0]cout << pf[0] << " " << pf[9] << "\n";
// or use *pf and *(pf + 9)
0 Questions:
Post a Comment