but now when i generate a password it has weird characters in it

Because there are unused bytes in the array that contain random junk characters. Initialize the whole array with 0s before doing anything.

char password[5 + 5 + 5 + 5 + 1] = {0}; // 4 Upper, 4 Lower, 2 Num, 2 Symbols


anyone please write a program to enter password that should be 6 alphabet, 3 digit, 1 special character and it should be in sequence in c

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.