#include<stdio.h>
void print(int a[])
{
int i;
for( i=0;i<=8;i++)
{
printf("%d ",a[i]);
}
}
int Qsort(int data[], int left, int right)
{
int mid,tmp,i,j;
i = left;
j = right;
mid = data[(left+right)/2];
do
{
while (data[i] < mid)
i++;
while (mid < data[j])
j--;
if (i <= j)
{
tmp = data[i];
data[i] = data[j];
data[j] = tmp;
i++;
j--;
}
}
while (i <= j);
{
if (left < j)
Qsort(data,left,j);
if (i < right)
Qsort(data,i,right);
}
}
main()
{
int array[]={12,99,4,99,12,12,13,10,13};
printf("Before sort:\n\n");
print(array);
Qsort(array,0,8);
printf("\n\nAfter sort:\n\n");
print(array);
printf("");
}
Well, this is a very open question, please be specific, I will try try to answer this as well, a simple c language program can be any thing from printing your name on the screen to printing some patterns using symbols, or making a small game, or a simple calculator program. you can a clearer picture of what can be a simple c language program here:
it is a step by step program written in simple English for our understanding
No, quicksort is not a stable sorting algorithm.
Not used
You mean 'count' as variable-name? It is optional.
Reference:cprogramming-bd.com/c_page1.aspx#simpleinterest
Write a simple program in finding roots x^3-6x^2+11x-6.1=0
quicksort
Quicksort is a popular algorithm to sort items in software, aiming at completion in the smallest number of steps (shortest time) possible.
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
int main (void) { puts ("Hello, world"); return 0; }
the features of a C program