Can anyone tell me what is the error in program mentioned below. It shows syntax error : missing ';' before '{'. I am using visual studio compiler.
#include<stdio.h>
void main()
{
cts();
cts()
{
printf(" hi ");
}
}
Can anyone tell me what is the error in program mentioned below. It shows syntax error : missing ';' before '{'. I am using visual studio compiler.
#include<stdio.h>
void main()
{
cts();
cts()
{
printf(" hi ");
}
}
Uh, where to begin.
First of all, main() should return an int, and probably receive void:
Secondly, you are defining a function cts() inside of main(). You aren't supposed to do that. You might want something like this as your function definition:Code:int main(void)
Code:void cts(void) { printf(" hi "); }
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
On top of all that, you forgot the semicolon after the second cts(), hence the error you get.
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition