C Program To Find Permutations of String

C Program To Find Permutations of String using Recursion

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

Tushar Soni

I am Tushar Soni, Co - Founder of CodingAlpha. I am a computer science student from India and passionate about Web Development and Programming. Connect with me on Facebook | LinkedIn | Google Plus

4 thoughts on “C Program To Find Permutations of String

  • October 30, 2016 at 9:50 pm
    Permalink

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

    Reply
  • November 2, 2016 at 6:25 pm
    Permalink

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

    Reply
  • November 5, 2016 at 6:14 pm
    Permalink

    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
  • November 24, 2016 at 10:13 am
    Permalink

    It is so simple to implement once you understand the logic.

    Reply

Join The Discussion