Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void macierz(int x, int y, int** &tab)
- {
- tab = (int**)malloc(x * sizeof(int*));
- for (int i = 0; i < x; i++)
- {
- tab[i] = (int*)calloc(y, sizeof(int));
- }
- }
- void wypisanie(int wier,int kol, int** &tab)
- {
- for (int i = 0; i < wier; i++)
- {
- for (int j = 0; j < kol; j++)
- {
- cout << tab[i][j] << " ";
- }
- cout << endl;
- }
- }
- int main()
- {
- int** tab;
- int kol, wier;
- cout << "kolumny" << endl;
- cin >> kol;
- cout << "Wiersze" << endl;
- cin >> wier;
- cout << endl;
- macierz(wier, kol, tab);
- wypisanie(wier, kol, tab);
- for (int i = 0; i < wier; i++)
- {
- free(tab[i]);
- }
- free(tab);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement