0

I am unable to implement pointers in this code

I am asked to use the pointers provided in the functions' prototypes, but I don't know how to use them in this case. Here's the link to my code: https://code.sololearn.com/c1a90A1A11a3 This code is error-free.

7th Mar 2021, 3:25 PM
Salma D. Elabsi
Salma D. Elabsi - avatar
2 Respostas
+ 2
The code has lot of errors. Function calling is in wrong way.. Ex: void print(int i); //this is function prototype int main() { int j=12345; print(j); //this is calling function } //this is function definition or implementation void print(int i ) { printf("%d", i); } Observe how it is used. In your code, you function calling is wrong way.. and all passed variables must be declared and initialized before passing to function.. For 1st one : calculate_mean(temperatures, N, &mean); Here you must initialize N, mean . Do the same for next one...
7th Mar 2021, 3:44 PM
Jayakrishna 🇮🇳
+ 1
I can correct it but this looks like you are trying to implement something you didn't even try. You are assuming and passing wrong arguments , defining a function in main instead of calling it. It's not just about "pointers" . can you maybe go through basics of C again ? Obviously i will correct it later on or someone else will for you.
7th Mar 2021, 3:38 PM
Abhay
Abhay - avatar