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...


code for selection sort?



code for selection sort?..

Answer / naveen shukla

#include<stdio.h>
#include<stdlib.h>
int main(){
int n,i,t;
printf("Enter the size of the array");
scanf("%d",&n);
int *p=(int *)malloc(sizeof(int)*n);
for(i=0;i<n;i++){
printf("Enter the %d" i+1 "number in the array");
scanf("%d;t);
*(p+i)=t;
}
for(j=0;j<n-1;j++){
int pos=j;
int k=j+1;
int min=*(p+j);
while(k<n){
if(a[k]<min){
m=p[k];
pos=k;
}
k++;
}
int temp=p[pos];
p[pos]=a[j];
a[j]=temp;
}
return 0;
}

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Interview Questions

what are two kinds of java

2 Answers  


how can i print "hello"

3 Answers  


? ???Mirror Mirror on the wall????????

1 Answers   channel V, DPI,


Difference between exit() and _exit() function?

0 Answers  


value = 0xabcd; for (loop = 1; (value >> 1) & 1 | loop & 1; loop++) { foo(); if (loop & 1) value >>= 1; } how many times is foo() executed?

6 Answers   Google,


IS Doon college of Engn.. has good faculty

1 Answers  


What is wrong in this statement? scanf(“%d”,whatnumber);

0 Answers  


Sir i need notes for structure,functions,pointers in c language can you help me please

0 Answers   TCS,


Explain how can I read and write comma-delimited text?

0 Answers  


why integer range between -327680to+32767

2 Answers  


while initialization of two dimensional arrays we can initialize like a[][2] but why not a[2][] is there any reason behind this?

4 Answers   Aptech,


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

0 Answers  


Categories