Hello all,
So I am not too familiar with using arrays with C
But basically what I want to do is have a function where I can pass in a value and a filled array and move every value over one, throw out the last one and put a new value in the beginning.
I do not really understand the whole * thing in c, but I have seen it around, I am not sure if I need to do it to get this function to work properly.
int brain_data[30]={82960, 21827, 39586, 34202, 47124, 69690, 9468, 47798, 6563, 47456, 42494, 66574, 92910, 19151, 23587, 155965, 45245, 33233, 23437, 22788, 168338, 4015, 20487, 44382, 8065, 85082, 5408, 147608, 109213, 109210};
int * addValue(int number , int array[]){
for (int i=0; i<29; i++){
int array_val;
array_val=array[i];
array[i+1]=array_val;
}
array[0]=number;
return array;
}
void setup()
{
Serial.begin(9600);
Serial.println(addValue(500, brain_data));
}
void loop(){
}
This code returns the following error:
call of overloaded 'println(int*) is ambiguous