error C2601 && fatal error C1004

Hello,
my program have two errors which are error C2601 && fatal error C1004.
and these are saying that;

error C2601: 'main' : local function definitions are illegal
fatal error C1004: unexpected end of file found

I cannot fix these problems!

and my code is like as follows;

int main()
{
string mword = "";
string newword = "";
string syl = "";

int pointer = 0;
int len = 0;

cout << "Enter a word:" << endl;

cin >> mword;

len = mword.length();
pointer = mword.length()-1;

newword=rest(mword, pointer);
cout << newword << endl;

return 0;
}
"local function definitions are illegal" means that you've attempted to define a function while inside of another function. Define it outside of all other functions.
ok, I understand what you mean but I still cannot see anything like you said in my code :\
look where you've defined the rest function, because you haven't defined a function in main.
Yes. My guess is that you probably forgot and ending curly brace } at the end of a function definition elsewhere.
Last edited on
Finally I saw my mistake :)
It was in my one of other functions that I forgot an ending curly brace as Zhuge said..
Thank you.
Topic archived. No new replies allowed.