A function-definition is not allowed here before '{' token

Hello this is my first question what am I doing wrong? I need to figure out what I'm missing. If you know please tell me so I can learn from this. Heres the code:

void czr(int czr) {
void doubleclick() {  // what happens when button is double-clicked
int CO2 = czr.CO2();
ScreenConfigtextco2(2, 1500, "2 Click", CO2 / 1000, "%");
}
void singleclick() {  // what happens when the button is clicked
int CO2 = czr.CO2();
ScreenConfigtextco2(2, 1500, "1 Click", CO2 / 1000, "%");
}
void longclick() {  // what happens when buton is long-pressed
int CO2 = czr.CO2();
ScreenConfigtextco2(2, 1500, "Long Click", CO2 / 1000, "%");
 }

Welcome to the forum

Look at your code formatted slightly differently

void czr(int czr)
{
    void doubleclick()
    {  // what happens when button is double-clicked
        int CO2 = czr.CO2();
        ScreenConfigtextco2(2, 1500, "2 Click", CO2 / 1000, "%");
    }
    void singleclick()
    {  // what happens when the button is clicked
        int CO2 = czr.CO2();
        ScreenConfigtextco2(2, 1500, "1 Click", CO2 / 1000, "%");
    }
    void longclick()
    {  // what happens when buton is long-pressed
        int CO2 = czr.CO2();
        ScreenConfigtextco2(2, 1500, "Long Click", CO2 / 1000, "%");
    }

Do you see how the doubleClick() function, and others, are defined within the czr() function ?

In future, please post a your whole sketch rather than a snippet, and the full error message copied from the IDE using the convenient button

Ok no problem. So, another question. If that's the case, should I combine all the 4 pieces of code I have and then edit the code from there? or should I keep the four parts of code separate? all four pieces of code do different things.

Thank you very much I'll go look at those right now.