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 |
Write a program to find the given number is odd or even without using any loops(if,for,do,while)
Why pointers are used?
What is string in c language?
What is difference between class and structure?
I have a varargs function which accepts a float parameter?
What is a program flowchart?
What does struct node * mean?
Tell us something about keyword 'auto'.
What do you understand by normalization of pointers?
Explain how do you search data in a data file using random access method?
Which command is more efficient? *(ptr+1) or ptr[1]
4)What would be the output? main() { int num=425; pf("%d",pf("%d",num)); } a)Comp error b)4425 c)4253 d)3435 e)none