Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Matrix
- {
- double** matrix;
- int n;
- int m;
- };
- struct Matrix getMatrix(int n, int m)
- {
- struct Matrix result;
- result.n = n;
- result.m = m;
- result.matrix = (double*)calloc(n, sizeof(double*));
- for (int i = 0; i < n; i++)
- {
- double* arr = (double*)calloc(m, sizeof(double*));
- result.matrix[i] = arr;
- }
- return result;
- }
- int main()
- {
- struct Matrix matrix1 = getMatrix(2, 3);
- struct Matrix matrix2 = getMatrix(3, 4);
- free(&matrix1);
- free(&matrix2);
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement