Hi all, I have some code that I am trying to compile and every time I try I keep getting an error on the for loop.
I compiled this same code before without any problem with Dev C++ Compiler running both Win 98SE and XP. I originally got this code online as I wanted a random pasword generator. When I 1st got it I even made changes to suit my needs and it still compiled. I say that because I'm still a newbie to C. I will post the code below to see. Thanks in advance,
array
#include <stdio.h>
#include <stdlib.h>
char gen_letter(void)
{
char ch = (rand() % 26) + 'a';
return ch;
}
char gen_alphanum(void)
{
char vAlpha[] = "D9kc1ZayFj2mTds6Mx2Q8UiCp1J9uEoIw3Aq5GYL4gNr8WhBV 3PfH7KbX6l4SvL6Ot5n";
char ch = vAlpha[ rand() % 68 ];
return ch;
}
void gen_pass(char *sPassWord, int iSize)
{
if (iSize < 1)
{
sPassWord[0] = '\0';
return;
}
sPassWord[0] = gen_letter();
for ( i=1; i < iSize; i++)
sPassWord[i] = gen_alphanum();
sPassWord[iSize] = '\0';
}
int main(void)
{
char password[15];
srand((unsigned int) (GetTickCount() / 100) );
gen_pass(password, 14);
printf("\nPassword: ");
printf(" \n");
printf(" \n");
system("PAUSE");
return 0;
}