Q:
Write a C Program to Sort Infinite Numbers in Ascending Order
belongs to collection: C Pointer Solved Programs – C Programming
C Pointer Solved Programs – C Programming
- C Program to Access elements of an array using pointer
- Write a C Program to Swap Two Numbers Using Call by Reference
- C Program to Find Largest Number Using Dynamic Memory Allocation
- Write a C Program to Sort Infinite Numbers in Ascending Order
- Write a C program to Swap two numbers using pointers
- Write a C Program to Reverse each word in string using pointers
- Write a C Program to reverse string using pointers and function
- Write a C Program to find largest number using pointers
- Write a C Program to find sum and average of n numbers using pointers
- C Program to Sort n numbers in ascending order using pointers
- C Program to check string is palindrome or not using pointers
- Write a C Program to Get Address of array using Pointers
- C program to count number of vowels and consonants in a string using pointer
- Write a C program for Student details using pointer and structure
- Write a C program to Print string using pointers
- Write a C program to print size of different data types using pointers
- C program to perform double pointer or Pointer to Pointer
- Write a C program to perform Array of pointers
- Write a C Program to implement Stack Operations Using Pointer
- Write a C Program to Find Length of String using Pointers
- Write a C Program to Reverse array using Pointers
- Write a C Program to display array with addresses using pointers
- Write a C Program for Addition of Two Numbers Using Pointers
- Write a C Program to dereference pointer variables
- Write a C Program to show an example of pointer to pointer
- C Program to print value and address of elements of an array using pointer
- Write a C Program to perform Call By Value and Call By Reference methods
- Write a C Program to return more than one value from a function
- Write a C Program for dynamic memory allocation using malloc( )
- Write a C Program to understand the use of realloc() function
- Write a C Program to understand pointers to structures
- Write a C Program to understand how pointer to structure variable is sent to function
- Write a C Program to understand how pointer to structure returned from function
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 −
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 .
need an explanation for this answer? contact us directly to get an explanation for this answer