Write a C Program to Sort Infinite Numbers in Ascending Order

By | November 29, 2016

Sort Infinite Numbers in Ascending Order


Write a C Program to Sort Infinite Numbers in Ascending Order. Here’s simple Program to Sort Infinite Numbers in Ascending Order using pointers in C Programming Language.


What are Pointers?


A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before using it to store any variable address.

The general form of a pointer variable declaration is

  • type *var-name;

Here, type is the pointer’s base type; it must be a valid C data type and var-name is the name of the pointer variable.

The asterisk * used to declare a pointer is the same asterisk used for multiplication. However, in this statement the asterisk is being used to designate a variable as a pointer.


PROGRAM : :

In this program we are reading infinite numbers and then arranging them in ascending order. Here infinite means, the program should read numbers until a particular number is entered to terminate the reading process.

In our case we are using -1 to stop the reading process. As we already don’t know how many numbers will be entered by the user so we are using concept of dynamic memory allocation to allocate memory for a number at the run time.


Below is the source code for C Program to Sort Infinite Numbers in Ascending Order using pointers which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :



Output  : :



Above is the source code for C Program to Sort Infinite Numbers in Ascending Order using pointers which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

Leave a Reply