My code is working correctly using array notation, but I'm not allowed to use it in this program. I have to use pointer arithmetic. I have an array called yearEndRank [20][6] that we input 5 scores to. The displaying output has to sort them and give the highest ran, which is technically the lowest number. The code I pasted below works, but I am not allowed to use it, since it is not pointer arithmetic. Any help?
1 2 3 4 5 6 7 8 9 10 11
Put the code youint computeHighestRank (int locYearEndRank, int locSlot)
{
int temp = locYearEndRank[locSlot][1];
for (int rank = 1; rank < 6; rank++)
{
if (locYearEndRank [locSlot][rank] < temp) temp = locYearEndRank [locSlot][rank];
}
return temp; need help with here.
Sorry for being basic here, but do I start my pointer when im declaring that function prototype at the beginning of my code? Or does it wait until I'm inside of the main?
Sorry for being basic here, but do I start my pointer when im declaring that function prototype at the beginning of my code? Or does it wait until I'm inside of the main?
int xs[] = { 7, 8, 9 }; // array of integers
int* p = &x[ 0 ]; // *p is 7
cout << *p << end; // prints "7"
p += 1; // update to point to the next integer
cout << *p << endl; // prints "8"