Hi,
I have this sample program where the compiler gives me error for the break statement.
The error is " misplaced break in afunction"
Could anyone help me understanding why the break statement gives an error? i understand that u can use break in a for , while loop etc., and exit early when required.
thanks for the help
#include <iostream.h>
void afunction()
{
if(1)
{
cout<<"Err";
break;
}
}
int main ()
{
afunction();
}