Lab 12
Lab 12
Lab 12
h>
#include <stdlib.h>
printf("Enter %d integers:\n",
+) {
+ 1); scanf("%d",
Carr[i]);
*sum = 0;
*sum += arr[i];
int temp =
arr[j]; arr[j] =
+ 1] = temp;
}
}
}
}
size) { printf("Sorted
int main() {
int size;
rn(arr,
size); int
sum; float
avg;
sort(arr, size);
show(arr, size);
free(arr);
}
Q2) #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char
fullName[100];
int n;
n = strlen(fullName) - 1;
strncpy(dynamicarray,
= '\0';
free(dynamicarray);
#include <stdlib.h>
#include <string.h>
int main() {
char
fullName[100];
char
studentid[50];
int n;
printf("Enter your full name (First Name + Last
n = strlen(fullName) - 1;
strncpy(dynamicarray,
= '\0';
fgets(studentid, sizeof(studentid),
stdin); studentid[strcspn(studentid,
strlen(studentid);
free(dynamicarray);
dynamicarray = resizedarray;
strcat(dynamicarray,
studentid);
free(dynamicarray);