Advertisement
Guest User

BITMAP

a guest
Jan 25th, 2015
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.99 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int **initiateTable(int x, int y){
  5.     int i, **table;
  6.  
  7.     table = (int**)calloc(y, sizeof(int*) );
  8.  
  9.     if (table == NULL){
  10.         printf("Nie moge przydzielic pamieci!\n");
  11.         return NULL;
  12.     }
  13.  
  14.     for (i = 0; i < y; i++){
  15.         table[i] = (int*)calloc(x, sizeof(int));
  16.  
  17.         if (table[i] == NULL){
  18.             printf("Nie moge przydzielic pamieci!\n");
  19.             return NULL;
  20.         }
  21.     }
  22.  
  23.     return table;
  24. }
  25.  
  26. void readDescription()
  27. {
  28.     int t, n, m, i, j, **table, p;
  29.     scanf("%d", &t);
  30.     while(t>0)
  31.     {
  32.         scanf("%d %d", &n, &m);
  33.         fflush(stdin);
  34.         table = initiateTable(m,n);
  35.         for(i=1; i<=n; i++)
  36.         {
  37.             for(j=1; j<=m; j++)
  38.             {
  39.                 p=getch();
  40.                 printf("%c", p);
  41.             }
  42.             getch();
  43.             printf("\n");
  44.         }
  45.         t--;
  46.     }
  47.  
  48. }
  49.  
  50. int main()
  51. {
  52.     readDescription();
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement