Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int **initiateTable(int x, int y){
- int i, **table;
- table = (int**)calloc(y, sizeof(int*) );
- if (table == NULL){
- printf("Nie moge przydzielic pamieci!\n");
- return NULL;
- }
- for (i = 0; i < y; i++){
- table[i] = (int*)calloc(x, sizeof(int));
- if (table[i] == NULL){
- printf("Nie moge przydzielic pamieci!\n");
- return NULL;
- }
- }
- return table;
- }
- void readDescription()
- {
- int t, n, m, i, j, **table, p;
- scanf("%d", &t);
- while(t>0)
- {
- scanf("%d %d", &n, &m);
- fflush(stdin);
- table = initiateTable(m,n);
- for(i=1; i<=n; i++)
- {
- for(j=1; j<=m; j++)
- {
- p=getch();
- printf("%c", p);
- }
- getch();
- printf("\n");
- }
- t--;
- }
- }
- int main()
- {
- readDescription();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement