Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void) {
- int i, j;
- char **matrix = (char **) malloc(9 * sizeof(char *));
- const char **pmatrix = (const char **) malloc(9 * sizeof(char *));
- for (i = 0; i < 9; i++) {
- char *row = matrix[i] = (char *) malloc(9 * 3 + 1 + 1);
- for (j = 0; j < 9; j++) {
- sprintf(row, "%3d", (i + 1) * (j + 1)); row += 3;
- }
- sprintf(row, "\n");
- }
- for (i = 0; i < 9; i++) pmatrix[i] = matrix[i];
- for (i = 0; i < 9; i++) printf("%s", pmatrix[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement