Click here to Skip to main content
15,919,341 members

Comments by John R. Shaw (Top 26 by date)

John R. Shaw 16-May-20 12:26pm View    
Technically, that would be number 3. It is what 'toni_1' thought he/she was doing. Coping by value means a copy is passed on the stack, which is what number 3 is doing. What 'toni_1' was doing amounted to passing a pointer to the original array, which means any change to the array in the function would change the original. Number 3 would only change the copy. That is why we need to specify constant variables in our arguments (I tell you where the data is, but you are not allowed to change it).

:) Rubiks - best time 2.54 minutes (now, have no idea).
John R. Shaw 28-Mar-20 1:42am View    
Interesting. But do not post home work questions here. Grab a pencil and paper and figure it out.
I could put on a blind fold and see if I could do it.
John R. Shaw 13-Mar-20 13:17pm View    
LMAO! Thanks that's the best laugh I had in weeks.

I am still trying to stop and failing!
John R. Shaw 13-Mar-20 10:42am View    
You are correct :)
But if I did not introduce such mistakes, how would they learn?
John R. Shaw 11-Mar-20 12:23pm View    
And ending brace '}'. Also the weird '"' in the for loop will stop it from compiling.

Good catch on the 'free(p)'; otherwise BOOM!