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 |
What is a char c?
Write a program for Overriding.
Do pointers need to be initialized?
Why we use void main in c?
What are the types of arrays in c?
Stimulate calculator using Switch-case-default statement for two numbers
What is meant by global static? why we have to use static variable instead of Global variable
There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.
How will you delete a node in DLL?
write a program to display all prime numbers
Write a program to exchange two variaables without temp
What is the scope of static variable in c?