Code Error

I’m getting an error that States "20:1: error: expected declaration before ‘}’ token
This is the code:

#include <avr/io.h>
#define F_CPU 16000000
#include <util/delay.h>
#include <avr/interrupt.h>
void setup();
void initint0();
int main()
{
setup();
initint0();
}
void setup()
{
  DDRB = 0b00111000; 
  DDRD = 0b11111011;
  PORTD = 0b00000000;
}
}
void initint0()
{
SREG |= 0b10000000; 
EIMSK |= 0b00000001; 
EICRA |= 0b00000001; 
}
ISR (INT0_vect) 
{
}
void loop()
{
  int PButton=digitalRead(2);
	if (PButton == 0b00000000)
  {
    delay(3000);        
    PORTB = 0b00010000;
    delay(3000);              
    PORTB = 0b00001000;    
    delay(2000);              
    PORTD = 0b01000000;    
    delay(8000);
    PORTD = 0b10000000;
    delay(2000); 
    
  }
   else    
   {

    PORTB = 0b00100000;
    PORTD = 0b10000000;       
   }
}

If there are any other errors let me know, Thank you.

miramonj_22001:

void setup()

{
  DDRB = 0b00111000;
  DDRD = 0b11111011;
  PORTD = 0b00000000;
}
}

You have an extra closing brace ("}") in your code here, thus the error.

A very helpful troubleshooting tool is the Auto Format feature (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor). If you do an Auto Format and then compare the resulting indentation to your intended program structure, it will quickly point you to where there is a missing or extra brace.

Another useful feature of the Arduino IDE/Arduino Web Editor is that when you place the cursor next to one bracket, it puts a box around the matching bracket. In the Arduino IDE, if the cursor is next to the closing bracket and the opening bracket is off the screen then it will show the opening bracket line in a tool tip after a short delay.

Each bracket ("{", "}, "[", "]", "(", ")") should always have a matching bracket.

You need to remove a '}' character at line 18. See Arduino - Curly Braces Reference
And also, You should not define main() function.

You can define main() if you like, but you definitely should be aware of what you are doing, which its clear is not the case here. When you define a main() function in your sketch, you override the function of that name that is defined in the Arduino core library. Arduino’s main() looks like this:

int main(void)
{
	init();

	initVariant();

#if defined(USBCON)
	USBDevice.attach();
#endif
	
	setup();
    
	for (;;) {
		loop();
		if (serialEventRun) serialEventRun();
	}
        
	return 0;
}

One thing you should note is that it calls the loop() function from a perpetual for() loop. Your sketch never calls loop() at all, so your loop() function will never run.

There are also the calls to init(), initVariant(), and USBDevice.attach() that do important initialization required for the Arduino board to work as we normally expect it to. The ability to override main() is very nice for people who, for some reason, don’t want these functions to be called as usual. This, as well as the ability to disable the #include directive of Arduino.h allows you to be able to remove all the “Arduino magic”. However, the “Arduino magic” can be very useful and most of us prefer to use it. The choice is yours, but you should be aware of the consequences.