I am trying to make a password generator. Everything was going smoothly until I tried to repeat the main function at the end. The code goes like this:
I also would appreciate feedback on the code. I am still learning (when do we stop learning though?) and I want to improve as much as I can and as fast as I can.
// password generator
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main ()
{
    char answer;
    int c=0;
    int passlength;
    char randLWUPchar; // lowercase, uppercase, characters + numbers
    srand(time(NULL)); // seeding function
        printf("Type the wished password length:");
        scanf("%d", &passlength);
        while(c < passlength){
            randLWUPchar = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM"[rand () % 65];
            printf("%c", randLWUPchar);
            c++;
        }
            printf("\n\n\t\t...if it fails to prompt as wished, please restart...\n");
        printf("\n\n\t\t   Please select Y to restart or N to close");
        scanf("%c", &answer);
        if (answer == 'Y'){
                return main();
        }
        else if (answer == 'N'){
                return EXIT_SUCCESS;
        }
}
 
     
     
    