Qu9
Storage classes in C are used to determine the lifetime, visibility, memory location, and
initial value of a variable. There are four types of storage classes in C
o Automatic
o External
o Static
o Register
auto Storage Class
The auto storage class is the default storage class for all local variables.
int mount;
auto int month;
The register Storage Class
The register storage class is used to define local variables that
should be stored in a register instead of RAM
register int miles;
static Storage Class
The static storage class instructs the compiler to keep a local variable in
existence during the life-time of the program instead of creating and destroying
it each time it comes into and goes out of scope.
static int count = 5;
The extern Storage Class
The extern storage class is used to give a reference of a global variable that is
visible to ALL the program files
extern void write_extern();
………………………………………………………………………….
Qu5
#include <stdio.h>
struct student {
char name[50];
int usn;
float marks;
} s;
int main() {
printf("Enter information:\n");
printf("Enter name: ");
scanf("%S", &s.name);
printf("Enter roll number: ");
scanf("%d", &s.usn);
printf("Enter marks: ");
scanf("%f", &s.marks);
printf("Displaying Information:\n");
printf("Name: ");
printf("%s", s.name);
printf("Roll number: %d\n", s.usn);
printf("Marks: %.1f\n", s.marks);
return 0;
…………………………………………………………………………………………………
Qu7
One-dimensional arrays, also known as single arrays, are arrays with only one dimension or
a single row.
The syntax of a one-dimensional array in C programming language is as follows:
dataType arrayName[arraySize];
Ex: int arr[10];
void bubble_sort(int arr[], int n) {
int i, j;
for (i = 0; i < n - 1; i++) {
for (j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
……………………………………………………………………………………………………..
Qu8
SUM OF TWO MATRIX:
#include <stdio.h>
int main() {
int r, c, a[100][100], b[100][100], sum[100][100], i, j;
printf("Enter the number of rows (between 1 and 100): ");
scanf("%d", &r);
printf("Enter the number of columns (between 1 and 100): ");
scanf("%d", &c);
printf("\nEnter elements of 1st matrix:\n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("Enter element a%d%d: ", i + 1, j + 1);
scanf("%d", &a[i][j]);
printf("Enter elements of 2nd matrix:\n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("Enter element b%d%d: ", i + 1, j + 1);
scanf("%d", &b[i][j]);
// adding two matrices
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
sum[i][j] = a[i][j] + b[i][j];
// printing the result
printf("\nSum of two matrices: \n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("%d ", sum[i][j]);
if (j == c - 1) {
printf("\n\n");
return 0;