Passing arrays as function parameters
| Repentinus (9) | |||
Well, I have always had problems with arrays and functions together.
Problems with function Compare. Can anyone tell me what the hell I am doing wrong and how I should repair it. I need it like in four hours or I am dead. | |||
| Duoas (653) | |||
| I'm still not sure exactly what you are doing. Your Compare function returns the number of elements with .a equal to the 'current' element, exclusive, occurs. Right? Anyway, your compare function takes a pointer to array but
... Compare( array[n], ... ) ...passes an element of the array. What you want is a pointer to a specific index:
... Compare( &array[n], ... ) ...I'm not sure what you are doing, but generally such operations want to work across the entire vector/array:
... Compare( &array[0], ... ) ...Hope this helps. | |||
This topic is archived - New replies not allowed.
