Skip to main content
2 of 3
added 2 characters in body

Passing arrays into function in tideman

I've created a solution to week 3's tideman problem which is entirely logically correct. Unfortunately, I had to dodge the standard solution by commenting out parts of a function and altering its parameters, so my solution cannot be accepted by check50.

The problem i'm facing is using arrays in functions.

C implicitly converts arrays when they are used as parameters in functions, so how am I supposed to code with a function such as "int record_preferences(int ranks[])".

What does ranks[] even mean? An array? An element of the array?

I altered the parameters once to "int record_preferences(int k, int ranks[k])" and called it with "record_preferences(j, ranks[j])" so I could actually use an element of the array, but that produced errors.

Before anyone mentions pointers - they are only taught in week 4 - I believe this problem should be solvable without pointers .