1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sav [38]
2 years ago
9

Can you answer this question?

Computers and Technology
1 answer:
patriot [66]2 years ago
3 0

Answer:

To do this you'll need to use malloc to assign memory to the pointers used.  You'll also need to use free to unassign that memory at the end of the program using the free.  Both of these are in stdlib.h.

#include <stdlib.h>

#include <stdio.h>

#define SIZE_X 3

#define SIZE_Y 4

int main(void){

       int **matrix, i, j;

       // allocate the memory

       matrix = (int**)malloc(SIZE_X * sizeof(int*));

       for(i = 0; i < SIZE_X; i++){

               matrix[i] = (int *)malloc(SIZE_Y * sizeof(int));

       }

       // assign the values

       for(i = 0; i < SIZE_X; i++){

               for(j = 0; j < SIZE_Y; j++){

                       matrix[i][j] = SIZE_Y * i + j + 1;

               }

       }

       // print it out

       for(i = 0; i < SIZE_X; i++){

               for(j = 0; j < SIZE_X; j++){

                       printf("%d, %d:  %d\n", i, j, matrix[i][j]);

               }

       }

       // free the memory

       for(i = 0; i < SIZE_X; i++){

               free(matrix[i]);

       }

       free(matrix);

       return 0;

}

You might be interested in
Which of the following items can you locate in a document using the navigation pane? Choose the answer.
Rashid [163]

Answer:

D: All of the above

Explanation:

4 0
2 years ago
NEED HELP PLEASEE!!!
hjlf
                                                   Start
                                                  Guess
     Incorrect                                                                   Correct
-------------------------              Computer                    ----------------------
- displays incorrect               ------------                    - Displays "Well done"
- displays try again            counts number              - Informs the number of
                                           of guesses                     guesses



hope this helps

make 3 lines down from the start bubble, and do "IF- Then"


6 0
2 years ago
What menu allows you to look up a command and learn how to use it?
e-lub [12.9K]
The answer is help because it helps you<span />
5 0
2 years ago
Friday Night Funkin Fans, does this count as a leak if I share it?
Aliun [14]
Hmm no I don’t think so
7 0
2 years ago
Read 2 more answers
HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HEL
AURORKA [14]

Answer:

I should be C! :D

5 0
2 years ago
Read 2 more answers
Other questions:
  • For any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a space. Ex: I
    8·1 answer
  • In order to paint a wall that has a number of windows, we want to know its area. Each window has a size of 2 ft by 3 ft. Write a
    12·2 answers
  • A light or optical microscope most commonly used is called a(n) _____. bright-field microscope dark-field microscope electron mi
    8·2 answers
  • What is a telecomunications system? 1) A system that enables the transmission of data over public or private networks. 2) A comm
    11·1 answer
  • Print a countdown from n to 1 The function below takes one parameter: an integer (begin). Complete the function so that it print
    8·1 answer
  • Dillard’s wants to learn about its consumers' attitudes toward online purchases. There are numerous studies that are available a
    9·1 answer
  • Which of the following should you do if your accelerator is stuck? A. Pump your brakes to build fluid pressure. B. Shift to Neut
    14·2 answers
  • 1. Describe data and process modeling concepts and tools.
    9·2 answers
  • Write a factorial method that takes in an integer as input, recursively computes its factorial using BigInteger and return a Big
    7·1 answer
  • In cryptocurrency, a block is only considered valid if it has a.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!