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 |
Why c is a procedural language?
write a program of palindrome(madam=madam) using pointer?
Explain the difference between malloc() and calloc() in c?
How can I read and write comma-delimited text?
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
Explain demand paging.
What is a class?
how to determine the complexity of an algorithm as log(n)
Can we add pointers together?
i want to have a program to read a string and print the frequency of each character and it should work in turbo c
what is pointer ?
10 Answers Kernex Micro Systems,
Write a program of advanced Fibonacci series.