1) You shouldn't post pre-coloured text into code tags. The forum software does it for you.

2) learn how to indent your code in some meaningful way ... Click HERE

3) Your means of tracking unmatched braces is flawed because leftcount will routinely exceed right count every time a block is opened.

4) main() promises to return an integer to the OS... you do not. Here's the minimum C program...
Code:
int main (void)
  {

     // your code here

    return 0; }
And before you protest... yes it does matter. Your program may work correctly but if it's not interfacing with the OS correctly it can cause other kinds of errors.


You might investigate a somewhat simpler form of that, tracking only open braces...
a) Each time you find an open brace, increment a counter...
b) Each time you find a closing brace, decrement the same counter...
c) if at the end of the file the counter is not 0... there's a mismatch.