unidentified

\Source\irc.cpp(662) : error c2065 'i' : undeclared identifier

the error is on line:

rndnick[i] = '\0';

script is:

char *IRC::nickgen_rndltr(void)
{
static char rndnick[MAX_NICKLEN];
ZeroMemory(rndnick,MAX_NICKLEN);

for (int i=0;i<=nicklen;i++)
rndnick[i] = (rand()%26)+97;
rndnick[i] = '\0';

return rndnick;
}
*record scratches*

You left out the brackets in your for loop, buddy. ;)

-Albatross

P.S.-Welcome to the forums!
Last edited on
Sorry i'm 1100% new to this C++ can you guide me through what to do? sorry haha

and thanks for welcoming me.
I wonder why you're messing around with a file called irc.cpp... :P

At the end of the line that contains
for (int i=0;i<=nicklen;i++)
Insert an (EDIT: opening) curly bracket.

Then, at the end of the line that had an error, insert a closing curly bracket, (EDIT: after the semicolon).

That should fix your problem.

-Albatross
Last edited on
to be honest, i don't know what those are..

so basicly like this:

for (int i=0;i<=nicklen;i++) { }

Last edited on
Except that
1
2
rndnick[i] = (rand()%26)+97;
rndnick[i] = '\0';
should be in the { }.

-Albatross.

P.S.- http://cplusplus.com/doc/tutorial/
Topic archived. No new replies allowed.