1.A
2. 6 2 3 4 5
3. D
4. 5
5.D
6. 0x7fffb6514a90, 0x7fffb6514a90, 0x7fffb6514a90, 0x7fffb6514aa4, 19, 1
7.
#include<stdio.h>
double Swap(double *a,double *b);
int main(){
double x = 80.0,y =90.0;
Swap(&x,&y);
printf("x=%f,y=%f",x,y);
return 0;
}
double Swap(double *a,double *b){
double temp;
temp = *a;
*a = *b;
*b = temp;
}
#include<stdio.h>
double Swap(double x,double y);
int main(){
double a = 100.0,b = 200.0;
Swap(a,b);
printf("a=%f,b=%f",a,b);
return 0;
}
double Swap(double x,double y){
double temp;
temp = x;
x = y;
y = temp;
}
8.
#include <stdio.h>
#include <stdlib.h>
void bubble_sort(float *arr, int n) {
float temp;
int i, j;
for (i = 0; i < n - 1; i++) {
for (j = 0; j < n - i - 1; j++) {
if (*(arr + j) > *(arr + j + 1)) {
temp = *(arr + j);
*(arr + j) = *(arr + j + 1);
*(arr + j + 1) = temp;
}
}
}
}
int main() {
int i;
float arr[5], temp;
printf("Enter 5 real numbers: ");
for (i = 0; i < 5; i++) {
scanf("%f", &arr[i]);
}
bubble_sort(arr, 5);
printf("Sorted numbers in descending order:\n");
for (i = 0; i < 5; i++) {
printf("%.2f ", arr[i]);
}
return 0;
}