K
Ken Human
I want to generate every possible 16 character combination of the
characters 0-9, A-Z, and a-z programatically. My current code follows:
#include <stdio.h>
#include <ctype.h>
int main() {
char strBuf[17] = {0};
int i, j;
for(i = 0; i < 16; i++) {
for(j = '0'; j <= 'z'; j++) {
if(!isalnum(j)) continue;
strBuf = j;
printf("%s\n", strBuf);
}
}
return 0;
}
Only the last character increments. I understand my problem and I can
fix it with a for loop for each space in the array, but I'd like to know
if there's a better solution.
characters 0-9, A-Z, and a-z programatically. My current code follows:
#include <stdio.h>
#include <ctype.h>
int main() {
char strBuf[17] = {0};
int i, j;
for(i = 0; i < 16; i++) {
for(j = '0'; j <= 'z'; j++) {
if(!isalnum(j)) continue;
strBuf = j;
printf("%s\n", strBuf);
}
}
return 0;
}
Only the last character increments. I understand my problem and I can
fix it with a for loop for each space in the array, but I'd like to know
if there's a better solution.