ptr[location] is a pointer to an integer, *(ptr[location]) is the integer.
The original if statement was comparing pointers, while the if statment I suggested changes this to compare the integers...
Type: Posts; User: rcgldr
ptr[location] is a pointer to an integer, *(ptr[location]) is the integer.
The original if statement was comparing pointers, while the if statment I suggested changes this to compare the integers...
Shouldn't the compare in printArray() be if( *(ptr[location]) > *(ptr[smallestIndex]) ) ... ?