We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
JUST ONE LINE ANSWER AFTER ALLOCATING THE MEMORY FOR BOTH ARRAYS;int main() {
total_number_of_books=(int*)calloc(total_number_of_shelves,sizeof(int)); total_number_of_pages=(int**)calloc(total_number_of_shelves,sizeof(int*)); for(int i=0;i
total_number_of_pages[i]=(int*)calloc(1100,sizeof(int));
} 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);
Dynamic Array in C
You are viewing a single comment's thread. Return to all comments →
JUST ONE LINE ANSWER AFTER ALLOCATING THE MEMORY FOR BOTH ARRAYS;int main() { total_number_of_books=(int*)calloc(total_number_of_shelves,sizeof(int)); total_number_of_pages=(int**)calloc(total_number_of_shelves,sizeof(int*)); for(int i=0;i total_number_of_pages[i]=(int*)calloc(1100,sizeof(int)); } 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);
* ((totalnumberofpages+x)+((totalnumberofbooks+x))++)=y; *