C Program To Find Permutations of String

By | October 30, 2016

Learn How To Find Permutations of String in C Programming. This C Program To Permute all letters of a string without Recursion makes use of Pointers. The C program prints all permutations of the string without duplicates. You can also modify the code to print permutations of a string with duplicates.

What is Permutation of a String?

String Permutations is a way to uniquely arrange all the letters of the string. These permutations may or may not include repetitions which can be modified in your program code.

Recursion is the best possible way of finding permutations of the string as it helps to build a clean code and also eases the debugging.

Example

String: xyz

Permutations:

xyz
xzy
yxz
yzx
zxy
zyx

Formula To Find Permutations of a given String

Find Value of nPr in C Programming using Functions

Algorithm To Calculate Permutations of a String

C Program For Permutations of String using Recursion

Output

C Program To Find Permutations of String using Recursion and Pointers

In case you get any compilation errors or any doubts in this C Program To Find Permutation of a String without Iterative method, let us know about it in the Comment Section below.

Recommended Programs
C Program To Calculate nPr
C Program For Number to Words Conversion
C Program To Evaluate A Polynomial Expression
C Program To Calculate nCr
C Program To Find Length of String
C Program To Compare Two Strings without Library Functions
C Program To Evaluate a Prefix Expression using Stack
C Program To Delete Vowels from a String
C Program To Find Date and Time
C Program To Arrange String Names is Descending Order

4 thoughts on “C Program To Find Permutations of String

  1. Shantanu Patil

    Thanks for this one! I was looking for a code that prints distinct permutations of any given string. This one does exactly that.

    Reply
  2. Vishwa Shah

    The swapping functions uses call by reference, if I am not mistaken.

    Reply
  3. Vijay Kumar

    Nice String Permutation Algorithm. Well, I have checked other codes on your website, it is a gold for us beginner programmers. Thanks a lot.

    Reply

Let's Discuss