Declare “int temp;” at the top. The same for all other variables. Do not declare the variables in GetState, just use them.
Remove all “return” lines from Getstate(). Just setting “temp=DHT.temperature;” sets the variable and is enough.
solved Problem With Functions And Printing Function Values in arduino [closed]