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 the difference between these initializations? Char a[]=”string”; Char *p=”literal”; Does *p++ increment p, or what it points to?
What is main () in c?
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.
Why is it usually a bad idea to use gets()? Suggest a workaround.
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
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
What extern c means?
main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please explain me.How it is coming like that?
How do I use void main?
what is an inline function?
What are dangling pointers in c?
Program to display given 3 integers in ascending order