by Dinesh Thakur Category: C Programming (Pratical)

In this Program pointer concept is been used with the use of variables of pointer type char and integer type which contain the values. Reorder () also used for sorting the the string as required. In the program string is to be entered after that loop statement works. During loop statement the pointer type variable acquires the memory using malloc() function.

The next move is to sort the string here loop statement again come in use and then printing the string. So on the next step string functions comes into the frame like Strcmp() or Strcpy() for conditionally checks the string. Here while using the string function if condition also comes into the place for checking if the string sorted or not in the last the sorted string is to be displayed as output.

Problem Statement:

Here we have to make a Program to sort the String with using Pointer and string Functions.

  1. Entering the String.
  2. Using required functions.
  3. Using loop Statement.
  4. And Display The Output on the Screen.

The C program is successfully compiled. The program output is also shown below.

void main()
      char *x[20];
      int i,n=0;
      void reorder(int n,char *x[]);
      printf("Enter no. of String : ");
                    printf("Enter the Strings %d : ",i+1);
                   x[i]=(char *)malloc(20*sizeof(char));
                   printf("\nreorder list is :  \n");
                              printf("%d %s\n",i+1,x[i]);
                   void reorder(int n,char *x[])
                              int i,j;
                              char t[20];

C Program Sort a List of Strings using Pointers

Related Articles on C Programming

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.