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 is the difference between these initializations? Char a[]=”string”; Char *p=”literal”; Does *p++ increment p, or what it points to?

4 Answers  


What is main () in c?

0 Answers  


sir i got 146 correct question & i have also the advantage of height so will they consider my marks as 146+3=149.can any body tell me how they consider my height marks.

1 Answers  


Why is it usually a bad idea to use gets()? Suggest a workaround.

1 Answers  


write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language

18 Answers   IT Park, TCS,


Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors

3 Answers  


What extern c means?

0 Answers  


main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please explain me.How it is coming like that?

3 Answers   Excel,


How do I use void main?

0 Answers  


what is an inline function?

2 Answers   TCS,


What are dangling pointers in c?

0 Answers  


Program to display given 3 integers in ascending order

1 Answers   N Tech,


Categories