Answer Posted / 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 View All Answers
Differentiate between functions getch() and getche().
What is a static variable in c?
Explain heap and queue.
Are there namespaces in c?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is structure in c definition?
Write a progarm to find the length of string using switch case?
Can you please explain the difference between exit() and _exit() function?
How many levels of indirection in pointers can you have in a single declaration?
Are there any problems with performing mathematical operations on different variable types?
What is time complexity c?
Why we use conio h in c?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
Why ca not I do something like this?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?