In your code,
if(restart == 'Y' || restart == 'y');
the trailing semicolon is an empty statement that forms the body of (and thus ends) the if
block. At this point you could have had an else
. But not after a subsequent statement that's not an if
.
Further, and more importantly, in your code, the call
main() ;
assuming it calls the main
in the global namespace, is invalid. main
(in the global namespace) is a special function. Among its special properties is that it can't be called.
The compiler may allow it without any diagnostic, but formally you then have Undefined Behavior where anything can happen.
Instead, use a loop to achieve repetition.