Click here to Skip to main content
16,016,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to i fix expected identifier or '(' before '{' token

What I have tried:

{
int i;
	for(i; delay>0; delay--)
	 {
		for(i =0; i<3195;i++)
	 }
}
Posted
Updated 16-Jun-22 21:33pm

C++
int i;
	for(i; delay>0; delay--) // you have not set i to any value*
	 {
		for(i =0; i<3195;i++) // you are now using the same variable in two loops, which will cause problems
	 }


* I suspect the first for statement should be something like:
C++
for(delay = some_number_greater_than_zero; delay>0; delay--)
 
Share this answer
 
Comments
CPallini 17-Jun-22 3:23am    
5.
Richard MacCutchan 17-Jun-22 3:26am    
Thank you (twice) :) .
Sravani Sandhya 17-Jun-22 7:09am    
I have tried the above suggestions still not working
Richard MacCutchan 17-Jun-22 7:20am    
Sorry, we cannot guess what you have tried, or what you mean by, "not working". Please use the Improve question link above, and add complete details of your revised code, and what results you see.
If you feed your favourite compiler (I am using GCC here) with
C
int main()
{ 
  int i;
  for(i; delay>0; delay--)
  {
    for(i =0; i<3195;i++)
  }
  return 0;
}

then you get an output similar to
program.c: In function ‘main’:
program.c:4:2: warning: statement with no effect [-Wunused-value]
    4 |  for(i; delay>0; delay--)
      |  ^~~
program.c:4:9: error: ‘delay’ undeclared (first use in this function)
    4 |  for(i; delay>0; delay--)
      |         ^~~~~
program.c:4:9: note: each undeclared identifier is reported only once for each function it appears in
program.c:7:2: error: expected expression before ‘}’ token
    7 |  }
      |  ^
That, I dare say, it is pretty informative.
 
Share this answer
 

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