Hello fellow CS50 pupils!

I have spent the past few days experimenting on the suggestions given in water.c walkthrough by writing different snippets of code.

I keep getting the following messages and just don't understand why it is asking for a ";" after int main (void) nor the "expected identifier '('" error.

Please, help! Thanks so much in advance![enter image description here]1

1 Answer 1


A function definition requires a { after the function signature. Your function does not have one now, so the compiler assumes you meant a function declaration instead, which requires a ;.

Place variable declarations either outside the function (making them global to your source file, do this only where necessary), or in the function (variables are block-scope, end their existence on leaving the block they're declared in), but there's no in-between.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .