Input Format
The first line contains an integer , the number of shelves in the library.
The second line contains an integer , the number of requests.
Each of the following  lines contains a request in one of the three specified formats.
  • For each query of the second type, it is guaranteed that a book is present on the  shelf at  index.
  • Both the shelves and the books are numbered starting from 0.
  • Maximum number of books per shelf .
Output Format
Write the logic for the requests of type 1. The logic for requests of types 2 and 3 are provided.

hackerrank dynamic array in c programming problem solution

Dynamic Array in C programming problem solution | HackerRank

#include <stdio.h>
#include <stdlib.h>
 * This stores the total number of books in each shelf.
int* total_number_of_books;
 * This stores the total number of pages in each book of each shelf.
 * The rows represent the shelves and the columns represent the books.
int** total_number_of_pages;

int main()
    int total_number_of_shelves;
    scanf("%d", &total_number_of_shelves);
    int total_number_of_queries;
    scanf("%d", &total_number_of_queries);
    for(int i=0; i<total_number_of_shelves; i++){
    while (total_number_of_queries--) {
        int type_of_query;
        scanf("%d", &type_of_query);
        if (type_of_query == 1) {
            int x, y;
            scanf("%d %d", &x, &y);

        } else if (type_of_query == 2) {