Problem passing array to a function

Hello, i’ve a programming problem passing an array to a function…
I’ve followed a post in this forum but i obtain an error:

In function ‘void normalProgram()’:
error: cannot convert ‘int ()[4]’ to 'int’ for argument ‘1’ to 'void uptime(int*)

I’ve done a lot of combinations…
Any idea?

void normalProgram(){
 ....
if(time >= display+1000){
        int uptimeinfo[4];
        lcd.clear();
        uptime(&uptimeinfo);
  }
}

void uptime(int *returninfo){
.....
}

uptime is expecting you to pass it an array element and you have passed it a standard int.

Sorry Mike but i have never programmed in C :frowning: so i can’t understand…

Trying to pass just an integer i’ve modified into

void uptime(int *returninfo){
}

void loop(){
          uptime(uptimeinfo[0]);
}

but IDE tells me:

In function ‘void normalProgram()’:
error: invalid conversion from ‘int’ to 'int*

What does it mean?

Nevertheless, i’d like to pass the array not just one element and i can’t understand the way :frowning:

In the C language, a variable that is declared as an array is the same as pointer.
So uptimeinfo is a pointer to the array uptimeinfo[4] and you can call the uptime function as follows:
uptime(uptimeinfo); // pass a pointer to the uptimeinfo array

There may be an easier way to do what you want, why not post the code in uptimeinfo with a brief description of the purpose of that function