Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program of bubble sort using pointer?

Answer Posted / gulam md gouss khan

#include<stdio.h>
#include<conio.h>
void sort(int *,int );//prototype
void main()
{
int a[5],size=5; //let suppose
int i;
clrscr();
printf("Enter the elements according to size:");
for(i=0;i<size;i++)
{
scanf("%d",&a[i]);
}
sort(a,size); //calling function
printf(\n\n press any key to exit);
getch();
}
void sort(int *p,int size) //called function
{
int i,j,temp;
for(i=0;i<size-1;i++)
{
for(j=0;j<size-i-1;j++)
{
if(*(p+J)>*(p+j+1))
{
temp=*(p+J);
*(p+J)=*(p+J+1);
*(p+J+1)=temp;
}
}
}

for(i=0;i<size;i++)
{ pritf("%d",*(p+i));
}

Is This Answer Correct ?    19 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I read and write comma-delimited text?

1068


What are the three constants used in c?

991


#include int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

1716


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

2171


What is a shell structure examples?

1092


How can I get back to the interactive keyboard if stdin is redirected?

1183


What is array in c with example?

1242


Where register variables are stored in c?

958


Explain void pointer?

1036


What is the use of ?: Operator?

1137


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

1224


what is bit rate & baud rate? plz give wave forms

1976


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1087


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

1094


Differentiate between new and malloc(), delete and free() ?

1181