Compile error " #include <studio.h>

#include <studio.h>
#define READINGSPERDAY 24
#define VERYHIGHTEMPERATURE 200
#define VERYLOWTEMPERATURE -200

int todaysReadings[] = {62, 64, 65, 68, 70, 71, 72,74, 75, 76, 78, 79, 78, 73, 70, 69, 68, 64, 63, 61, 59};

void setup() {
 Serial.begin(9600);
 
}

void loop() {
 int lowTemp;
 int hiTemp;
 int retVal;

 Serial.println("===Before function call:");
 Serial.print("The lvalue for lowTemp is: ");
 Serial.print((long) &lowTemp, DEC);
 Serial.print(" and the rvalue is ");
 Serial.println((long) lowTemp,DEC);
 Serial.print(" The lvalue for hiTemp is: ");
 Serial.print((long) &hiTemp,DEC);
 Serial.print(" and the rvalue is ");
 Serial.println((long) hiTemp,DEC);

 retVal = CalculateMinMax(todaysReadings, &lowTemp, &hiTemp);
 Serial.println("===After the function call:");
 Serial.print("The lvalue for lowTemp is:");
 Serial.print((long) &lowTemp,DEC);
 Serial.print("and the rvalue is ");
 Serial.println((long) lowTemp, DEC);
 Serial.print("The lvalue for hiTemp is: ");
 Serial.print((long) &hiTemp,DEC);
 Serial.print(" and the rvalue is: ");
 Serial.println((long) hiTemp,DEC);
 Serial.print("\n");

 Serial.flush();
 exit(0);
}
int CalculateMinMax(int temps[], int *minTemp, int *maxTemp){
 int j;
 *minTemp = VERYHIGHTEMPERATURE;
 *maxTemp = -VERYLOWTEMPERATURE;
 for(j = 0; j < READINGSPERDAY; j++){
   if(temps[j] >= *maxTemp){
     *maxTemp = temps[j];
   }
   if(temps[j] <= *minTemp){
     *minTemp = temps[j];
   }
 }
 return j;
}

Hi there.
And that's what I'm getting as an error...

Arduino: 1.8.5 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/deyangarabedyan/Documents/Arduino/MinMaxTemp/MinMaxTemp.ino:1:20: fatal error: studio.h: No such file or directory
 #include <studio.h>
                    ^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Did you find this code somewhere online? If so, post a link to it. We need some context about what this studio.h is.

Generally that error means that you need to install the library that contains the file but, after a quick glance at your code, I don't see anything that would require including a file.

Hi,

I'm currently reading "Beginning C for Arduino" - by Jack Purdum, and that's sample code for Pointers.

/*
Purpose: findnd the minimum and maximum values of an array of
data values
Dr. Purdum, August 13, 2012
*/

(deleted)

Compiles fine with this modification :wink:

// #include <studio.h>
int todaysReadings[] = {62, 64, 65, 68, 70, 71, 72,74, 75, 76, 78, 79, 78, 73, 70, 69, 68, 64, 63, 61, 59};

Do you really expect the temperature to exceed 255 degrees F?

 int lowTemp;
 int hiTemp;
 int retVal;

 Serial.println("===Before function call:");
 Serial.print("The lvalue for lowTemp is: ");
 Serial.print((long) &lowTemp, DEC);
 Serial.print(" and the rvalue is ");
 Serial.println((long) lowTemp,DEC);

Is the address of lowTemp really important? Why print the address in decimal?

Why are you casting the int to a long?