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 / anuj pratap singh

#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\npress 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 ?    40 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it fine to write void main () or main () in c?

1075


Which is an example of a structural homology?

1376


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

2385


What is the difference between array and linked list in c?

1202


how is the examination pattern?

2059


What is main function in c?

1133


How do you determine the length of a string value that was stored in a variable?

1170


Why doesnt that code work?

1271


How do I round numbers?

1051


Explain what are header files and explain what are its uses in c programming?

1201


Explain what is wrong with this statement? Myname = ?robin?;

1635


Explain the meaning of keyword 'extern' in a function declaration.

1203


What is the purpose of & in scanf?

1120


How do you list files in a directory?

1206


Differentiate between full, complete & perfect binary trees.

1166