Advertisement
dllbridge

Untitled

May 17th, 2023
786
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.57 KB | None | 0 0
  1.  
  2. #include  <stdio.h>
  3. #include <stdlib.h>
  4. #include <locale.h>
  5.  
  6. int M = 0,  // Строки
  7.     N = 0;  // Столбцы
  8.  
  9.  
  10.  
  11. //int arr[M][N];
  12.  
  13.  
  14. int *pA;
  15.  
  16.  
  17. ////////////////////////////////////////////////////////////
  18. int main()                                                //  
  19. {
  20.    
  21.     setlocale(LC_ALL, "rus");
  22.    
  23.     printf("Введите кол-во строк M и столбцов N: "); scanf("%d%d", &M, &N); printf("\n");
  24.    
  25.     printf("M = %d, N = %d\n", M, N);
  26.    
  27.     int *a = (int*)malloc(M * N * 4);
  28.    
  29.     for(int i = 0; i < M*N; i++)
  30.     {
  31.        
  32.         printf("%d\n", a[i]);
  33.     }
  34.    
  35.     free(a);
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. /*
  64.  
  65. #include <stdio.h>
  66.  
  67. #define SONY 77
  68.  
  69. int a = 1;
  70.  
  71.  
  72.  
  73.  
  74. int *pA;
  75.  
  76.  
  77. ////////////////////////////////////////////////////////////
  78. int main()                                                //  
  79. {
  80.     int  p[15];              // 123 * 4
  81.    
  82.     pA = p;
  83.    
  84.     printf("%d\n", p );
  85.     printf("%d\n", pA);
  86.     printf(" - - - - - - - - - \n");
  87.     for(int i = 0; i < 10; i++)
  88.     {
  89.        
  90.         printf("%10d - - - %10d\n", pA[i], p[i]);
  91.     }
  92. }
  93.  
  94.  
  95.  
  96. */
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. /*
  109.  
  110.  
  111. #include <stdio.h>
  112.  
  113. #define SONY 77
  114.  
  115. int a = 1;
  116.  
  117. int  p[123];              // 123 * 4
  118.  
  119.  
  120. int *pA;
  121.  
  122.  
  123. ////////////////////////////////////////////////////////////
  124. int main()                                                //  
  125. {
  126.    
  127.    
  128.     pA = p;
  129.    
  130.     printf("%d\n", p );
  131.     printf("%d\n", pA);
  132.     printf(" - - - - - - - - - \n");
  133.     for(int i = 0; i < 10; i++)
  134.     {
  135.        
  136.         printf("%d\n", pA[i] );
  137.     }
  138. }
  139.  
  140.  
  141. */
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
Advertisement
Comments
  • LaFacturacion
    1 year
    # text 0.21 KB | 0 0
    1. I wanted to drop you a note to say thank you for enlightening me about Pastebin. It has proven to be an invaluable tool for organizing and sharing data. Your thoughtfulness in sharing this resource is truly appreciated!
Add Comment
Please, Sign In to add comment
Advertisement