im solving a programming challenge where you have to devise a program to print out every possible combination of the letters in a string. the mini algorithm i have for the program will essentially switch every letter with every other letter, and is written rougly like so (copyarray is a copy of the original string)
all of the constants in this will be replaced by variables of course :)
however when im going through each character eventually adding numbers will cause it to go out of bounds of the array and give me some random crap when i output the string. how might i go about avoiding this?
do %string_length.
Though I'm not sure I understand the problem. Do you need to find every permutation of a given string? Now you're just rotating it..
trying to find every permutation, and ive already used strlen.
what do you mean by just rotating it? if i have the word dog for example replacing the numbers with the letters of the word it would end up like this