Click here to Skip to main content
15,073,911 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C
#include<stdio.h>
#include<conio.h>
int main ();
{
     for(int r=1;r<=3;r++)
	{
		for(int c=1;c<=3;c++)
		{
			printf("*");
		}
		printf("\n");
	}
	getch ()
 }

[Error] expected unqualified-id before '{' token


What I have tried:

i m trying to print 3 * in 3 rows and 3 columns
Posted
Updated 10-Nov-20 9:40am
v2
Comments
KarstenK 11-Nov-20 12:58pm
   
you only need to think about the message. It says that some invalid token are before that {-brace. ...

1 solution

C++
int main ();

You have a semi-colon at the end of the function declaration which means that everything else is 'orphaned' code. Remove that and it should work.
   
Comments
CPallini 10-Nov-20 15:38pm
   
5.
k5054 10-Nov-20 16:14pm
   
It's probably the one that should go after the getch() :)
Richard MacCutchan 11-Nov-20 3:51am
   
Well spotted.
Hammad Razzaq 11-Nov-20 14:45pm
   
thankss sir it help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900