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
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
Explain what is the purpose of "extern" keyword in a function declaration?
What is new line escape sequence?
Can the sizeof operator be used to tell the size of an array passed to a function?
Is there sort function in c?
What are the rules for the identifier?
Explain what is meant by 'bit masking'?
how many errors in c explain deply
Explain what is wrong in this statement?
What is the importance of c in your views?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
Can you please explain the difference between syntax vs logical error?
What is the use of parallelize in spark?
Can the curly brackets { } be used to enclose a single line of code?
What are the types of variables in c?