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
What are loops c?
Is exit(status) truly equivalent to returning the same status from main?
Is there any demerits of using pointer?
How to write a multi-statement macro?
Can we compile a program without main() function?
What is clrscr in c?
What are the different types of pointers used in c language?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
i want to know the procedure of qualcomm for getting a job through offcampus
Which control loop is recommended if you have to execute set of statements for fixed number of times?
differentiate built-in functions and user – defined functions.
Which of these functions is safer to use : fgets(), gets()? Why?
What are the types of type specifiers?
How do I read the arrow keys? What about function keys?
What is the method to save data in stack data structure type?