473,245 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,245 software developers and data experts.

Dynamic Memory Allocation for Matrix(2D array)

Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back.

By the way, my problem is like this i the first program was compiled and run without any erros but the second program has a run time error when the function return from allocate and the ptr become NULL. How to fixed this?

Second Program:

Expand|Select|Wrap|Line Numbers
  1.  
  2. /* Best Method to allocate memory for 2D Array because it's 
  3.    much more flexible
  4. */
  5.  
  6. /* int ***matrixptr ->  **rowptr     ->   *rowptr[nrow]  ->   element of row
  7.                         1st Matrix   ->   *rowptr[nrow]  ->   element of row
  8.                                      ->   *rowptr[nrow]  ->   element of row
  9.  
  10.                     ->  **rowptr     ->   *rowptr[nrow]  ->   element of row
  11.                         2nd Matrix   ->   *rowptr[nrow]  ->   element of row
  12.                                      ->   *rowptr[nrow]  ->   element of row
  13.  
  14.                     ->  **rowptr     ->   *rowptr[nrow]  ->   element of row
  15.                         3nd Matrix   ->   *rowptr[nrow]  ->   element of row
  16.                                      ->   *rowptr[nrow]  ->   element of row
  17. */
  18. // How to code this in C
  19.  
  20. #include<stdio.h>
  21. #include<stdlib.h>
  22. #include<assert.h>
  23.  
  24. /* int **rowptr -- A pointer to pointer to integer
  25.    This can be explain through graphically.
  26.    int **rowptr  ->   *rowptr[nrow] ->  element of row
  27.                  ->   *rowptr[nrow] ->  element of row
  28.                  ->   *rowptr[nrow] ->  element of row
  29. */
  30. static void Allocate(int, int **, int **, int *, int *, int *, int *);
  31. //int Symmetric(int *, int *, int *, int *);
  32.  
  33. void Add(int **, int **, int *, int *);
  34. void Subtract(int **, int **, int *, int *);
  35.  
  36. void Display(int **, int *, int *);
  37. //    int *nrow_ptr = NULL, *ncol_ptr = NULL;  
  38.  
  39. /*    int *nrow_ptr, *ncol_ptr;
  40.     // Declare the nrow_ptr and ncol pointer
  41.     nrow_ptr = &nrow;
  42.     ncol_ptr = &ncol;
  43.     // Initialized the nrow_ptr and ncol_ptr
  44. */   
  45.  
  46.  
  47. int main(int argc, char *argv[])
  48. {
  49.     static int **rowptr;
  50.     static int **rowptr_1;
  51.     static int **result;
  52.  
  53.     int nMatrix;
  54.     int nrow, ncol, nrow_1, ncol_1;
  55.     // Number of row and column
  56.     int *nrowptr;
  57.     int *ncolptr;
  58.     int *nrow_1ptr;
  59.     int *ncol_1ptr;
  60.     // Initialized the pointer pointing to nrow, ncol, 
  61.     // nrow_1, ncol_1 respectively
  62.     nrowptr = &nrow;
  63.     ncolptr = &ncol;
  64.     nrow_1ptr = &nrow_1;
  65.     ncol_1ptr = &ncol_1;
  66.     /*
  67.        Used while loop instead of dowhile because it's recommended
  68.        by Bjarne Stroustrup    
  69.     */
  70. // ------------------------------------------------------------
  71.     while(1)
  72.     {    // Must allocate at least two matrix
  73.         printf("\nPlease Enter same dimension for two Matrix\n");
  74.         printf("\nHow many Matrix : ");
  75.         scanf("%d", &nMatrix);
  76.  
  77.         printf("\nHow many Row for First Matrix : ");
  78.         scanf("%d", &nrow);
  79.         printf("\nHow many Column for First Matrix : ");
  80.         scanf("%d", &ncol);
  81.  
  82.         printf("\nHow many Row for Second Matrix : ");
  83.         scanf("%d", &nrow_1);
  84.         printf("\nHow many Column for Second Matrix : ");
  85.         scanf("%d", &ncol_1);
  86. // ------------------------------------------------------------                
  87.         Allocate(nMatrix, rowptr, rowptr_1, nrowptr, ncolptr, nrow_1ptr, ncol_1ptr);
  88.         if (rowptr || rowptr_1 == NULL)
  89.         {
  90.             perror("DMA for rowptr and rowptr_1 became NULL when came back from allcoate function");
  91.         }
  92.         Add(rowptr, rowptr_1, nrowptr, ncolptr);
  93.         // Adding the element of matrix
  94.         Subtract(rowptr, rowptr_1, nrowptr, ncolptr);
  95.         // Subtract the element of matrix
  96. //        Display(result, nrow, ncol);
  97.         // Display the result after successful allocated the memory
  98.  
  99.         free(rowptr);
  100.         free(rowptr_1);
  101.         free(result);
  102.     }
  103.  
  104.  
  105.     return 0;
  106.  
  107. }
  108. // -----------------------------------------------------------
  109. static void Allocate(int nMatrix, int **rowptr, int **rowptr_1,
  110.                      int *nrowptr, int *ncolptr,
  111.                      int *nrow_1ptr, int *ncol_1ptr)
  112. {
  113. //    int symmetric;
  114.     int row_loop, col_loop;
  115.  
  116.     switch(nMatrix)
  117.     {
  118.         case 1:
  119.         {
  120.             rowptr = (int **)malloc(sizeof(int **) * (*nrowptr));
  121.             if (rowptr == NULL)
  122.             {
  123.                 perror("Dynamic Memory Allocation for row Fails");
  124.             }    
  125.  
  126.             for (row_loop = 0; row_loop < (*nrowptr); row_loop++)
  127.             {
  128.                 rowptr[row_loop] = (int *)malloc(sizeof(int *) * (*ncolptr));
  129.                 if (rowptr[row_loop] == NULL)
  130.                 {    
  131.                     perror("Dynamic Memory Allocation for column Fails");
  132.                 }
  133.             }
  134.  
  135.             for (row_loop = 0; row_loop < (*nrowptr); row_loop++)
  136.             {
  137.                 for (col_loop = 0; col_loop < (*ncolptr); col_loop++)
  138.                 {
  139.                     printf("Enter the [%d][%d] number : ", row_loop, col_loop);
  140.                     scanf("%d", &rowptr[row_loop][col_loop]);
  141.                 }
  142.             }
  143.             break;
  144.         }
  145. // ------------------------------------------------------------
  146.         case 2:
  147.         {    // Enter the first matrix
  148. //            do
  149. //            {
  150.                 printf("\nEnter the First Matrix : \n");
  151.                 // Allocate memory for rowptr **
  152.                 // if nrow == 3, then same as rowptr *[3]
  153.                 rowptr = (int **)malloc(sizeof(int **) * (*nrowptr));
  154.                 if (rowptr == NULL)
  155.                 {
  156.                     perror("Dynamic Memory Allocation for row Fails");
  157.                 }    
  158.  
  159.                 // For each rowptr * , allocate ncolumn
  160.                 for (row_loop = 0;row_loop < (*nrowptr); row_loop++)
  161.                 {
  162.                     rowptr[row_loop] = (int *)malloc(sizeof(int *) * (*ncolptr));
  163.                     if (rowptr[row_loop] == NULL)
  164.                     {
  165.                         perror("Dynamic Memory Allocation for column Fails");
  166.                     }
  167.                 }
  168.  
  169.                 for (row_loop = 0; row_loop < (*nrowptr); row_loop++)
  170.                 {
  171.                     for (col_loop = 0; col_loop < (*ncolptr); col_loop++)
  172.                     {
  173.                         printf("Enter the [%d][%d] number : ", row_loop, col_loop);
  174.                         scanf("%d", &rowptr[row_loop][col_loop]);
  175.                     }
  176.                 }
  177.  
  178. // -----------------------------------------------------------
  179.                 // Enter the second Matrix
  180.                 printf("Enter the Second Matrix : \n");
  181.  
  182.                 // Allocate memory for rowptr_1 **
  183.                 // if nrow == 3, then same as rowptr_1 *[3]
  184.                 rowptr_1 = (int **)malloc(sizeof(int **) * (*nrow_1ptr));
  185.                 if (rowptr_1 == NULL)
  186.                 {
  187.                     perror("Dynamic Memory Allocation Matrix 2 for row Fails");
  188.                 }
  189.  
  190.                 // For each rowptr_1 * , allocate ncolumn
  191.                 for (row_loop = 0; row_loop < (*nrow_1ptr); row_loop++)
  192.                 {
  193.                     rowptr_1[row_loop] = (int *)malloc(sizeof(int *) * (*ncol_1ptr));
  194.                     if(rowptr_1[row_loop] == NULL)
  195.                     {
  196.                         perror("Dynamic Memory Allocation Matrix 2 for column Fails");
  197.                     }
  198.                 }
  199.  
  200.                 for (row_loop = 0; row_loop < (*nrow_1ptr); row_loop++)
  201.                 {
  202.                     for (col_loop = 0; col_loop < (*ncol_1ptr); col_loop++)
  203.                     {
  204.                         printf("Enter the [%d][%d] number : ", row_loop, col_loop);
  205.                         scanf("%d", &rowptr_1[row_loop][col_loop]);
  206.                     }
  207.                 }
  208.  
  209.                 // Check the Dimension of Two Matrix
  210.         /*        symmetric = Symmetric(nrowptr, ncolptr, nrow_1ptr, ncol_1ptr);
  211.                 if (symmetric == 1)
  212.                 {
  213.                     printf("The two Matrix is same dimension");
  214.                 }
  215.                 else
  216.                 {
  217.                     printf("The two Matrix is different dimension");
  218.                 }
  219.             }while(symmetric == 0); */ 
  220.             break;
  221.         }
  222.     }
  223. }
  224. // ------------------------------------------------------------
  225. int Symmetric(int *nrowptr, int *ncolptr, 
  226.               int *nrow_1ptr, int *ncol_1ptr)
  227. {
  228.     int symmetric;
  229.     if ((*nrowptr) == (*nrow_1ptr) && (*ncolptr) == (*ncol_1ptr))
  230.     {
  231.         symmetric = 1;
  232.         return symmetric;
  233.     }
  234.     else
  235.     {
  236.         symmetric = 0;
  237.         return symmetric;
  238.     }
  239. }
  240. // ------------------------------------------------------------    
  241. void Add(int **rowptr, int **rowptr_1, int *nrowptr, int *ncolptr)
  242. {
  243.     static int **result;
  244.     int row_loop, col_loop;
  245.  
  246.     // Allocate memory for result **
  247.     // if nrow == 3, then same as result *[3]
  248.     result = malloc(sizeof(int **) * (*nrowptr));
  249.     if (result == NULL)
  250.     {
  251.         perror("Dynamic Memory Allocation result for row Fails");
  252.  
  253.     }
  254.     // For each result * , allocate ncolumn
  255.     for (row_loop = 0; row_loop < (*nrowptr); row_loop++)
  256.     {
  257.         result[row_loop] = malloc(sizeof(int *) * (*ncolptr));
  258.         if (result[row_loop] == NULL)
  259.         {
  260.             perror("Dynamic Memory Allocation result for column Fails");
  261.         }
  262.     }
  263.     // Adding the element of two matrix
  264.     for (row_loop = 0;row_loop < (*nrowptr); row_loop++)
  265.     {
  266.         for (col_loop = 0; col_loop < (*ncolptr); col_loop++)
  267.         {
  268.             *(*(result + row_loop) + col_loop) =  *(*(rowptr + row_loop) + col_loop)   +  *(*(rowptr_1 + row_loop) + col_loop);
  269.         }
  270.     }
  271.  
  272.     Display(result, nrowptr, ncolptr);
  273. }
  274.  
  275. // ------------------------------------------------------------
  276. void Subtract(int **rowptr, int **rowptr_1, int *nrowptr, int *ncolptr)
  277. {
  278.     int row_loop, col_loop;
  279.     static int **result;
  280.  
  281.     // Allocate memory for result **
  282.     // if nrow == 3, then same as result *[3]
  283.     result = malloc(sizeof(int **) * (*nrowptr));
  284.     if (result == NULL)
  285.     {
  286.         perror("Dynamic Memory Allocation result for row Fails");
  287.  
  288.     }
  289.     // For each result * , allocate ncolumn
  290.     for (row_loop = 0; row_loop < (*nrowptr); row_loop++)
  291.     {
  292.         result[row_loop] = malloc(sizeof(int *) * (*ncolptr));
  293.         if (result[row_loop] == NULL)
  294.         {
  295.             perror("Dynamic Memory Allocation result for column Fails");
  296.         }
  297.     }
  298.     // Subracting the element of two matrix
  299.     for (row_loop = 0; row_loop < (*nrowptr); row_loop++)
  300.     {
  301.         for (col_loop = 0; col_loop < (*ncolptr); col_loop++)
  302.         {
  303.             *(*(result + row_loop) + col_loop) = *(*(rowptr + row_loop) + col_loop) - *(*(rowptr_1 + row_loop) + col_loop);
  304.         }
  305.     }
  306.     Display(result, nrowptr, ncolptr);
  307. }
  308.  
  309. // ------------------------------------------------------------
  310. void Display(int **result, int *nrowptr, int *ncolptr)
  311. {
  312.     int row_loop, col_loop;
  313.     // Loop for row and column
  314.  
  315.     for (row_loop = 0; row_loop < (*nrowptr); row_loop++)
  316.     {
  317.         for (col_loop = 0; col_loop < (*ncolptr); col_loop++)
  318.         {
  319.             printf("\nThe value of array at [%d][%d] is %d", row_loop, col_loop, *(*(result + row_loop) + col_loop) );
  320.         }
  321.     }
  322.  
  323. }
  324.  
  325. // ------------------------------------------------------------
  326.  
Thanks for your help.

Your help is greatly appreciated by me and others.
Apr 22 '07 #1
1 7923
The first program :

Expand|Select|Wrap|Line Numbers
  1.  
  2. /* Best Method to allocate memory for 2D Array because it's 
  3.    much more flexible
  4. */
  5.  
  6. /* int ***matrixptr ->  **rowptr     ->   *rowptr[nrow]  ->   element of row
  7.                         1st Matrix   ->   *rowptr[nrow]  ->   element of row
  8.                                      ->   *rowptr[nrow]  ->   element of row
  9.  
  10.                     ->  **rowptr     ->   *rowptr[nrow]  ->   element of row
  11.                         2nd Matrix   ->   *rowptr[nrow]  ->   element of row
  12.                                      ->   *rowptr[nrow]  ->   element of row
  13.  
  14.                     ->  **rowptr     ->   *rowptr[nrow]  ->   element of row
  15.                         3nd Matrix   ->   *rowptr[nrow]  ->   element of row
  16.                                      ->   *rowptr[nrow]  ->   element of row
  17. */
  18. // How do code this in C
  19.  
  20. #include<stdio.h>
  21. #include<stdlib.h>
  22. #include<assert.h>
  23.  
  24.  
  25. /* int **rowptr -- A pointer to pointer to integer
  26.    This can be explain through graphically.
  27.    int **rowptr  ->   *rowptr[nrow] ->  element of row
  28.                  ->   *rowptr[nrow] ->  element of row
  29.                  ->   *rowptr[nrow] ->  element of row
  30. */
  31. int Symmetric(int, int, int, int);
  32. void Add(int **, int **, int, int, int, int);
  33.  
  34. void Display(int **, int , int );
  35. //    int *nrow_ptr = NULL, *ncol_ptr = NULL;  
  36.  
  37. /*    int *nrow_ptr, *ncol_ptr;
  38.     // Declare the nrow_ptr and ncol pointer
  39.     nrow_ptr = &nrow;
  40.     ncol_ptr = &ncol;
  41.     // Initialized the nrow_ptr and ncol_ptr
  42. */   
  43.  
  44.  
  45. int main(int argc, char *argv[])
  46. {
  47.  
  48.     int nMatrix;
  49.     int nrow, ncol, nrow_1, ncol_1;
  50.     // Number of row and column
  51.  
  52.     int row_loop, col_loop;
  53.     // Loop for row and column
  54.  
  55.     int **rowptr = NULL;   // -- First Matrix
  56.     // A pointer to pointer to integer
  57.  
  58.     int **rowptr_1 = NULL; // -- Second Matrix
  59.     int **result = NULL;  // Result of two Matrix
  60.     int symmetric;
  61.     /*
  62.        Used while loop instead of dowhile because it's recommended
  63.        by Bjarne Stroustrup
  64.     */
  65. // ------------------------------------------------------------
  66.     while(1)
  67.     {    // Must allocate at least two matrix
  68.         printf("\nPlease Enter same dimension for two Matrix\n");
  69.         printf("\nHow many Matrix : ");
  70.         scanf("%d", &nMatrix);
  71.         switch(nMatrix)
  72.         {
  73.             case 1:
  74.             {
  75.                 printf("How many Row : ");
  76.                 scanf("%d", &nrow);
  77.                 rowptr = (int **)malloc(sizeof(int **) * nrow);
  78.                 if (rowptr == NULL)
  79.                 {
  80.                     perror("Dynamic Memory Allocation for row Fails");
  81.                 }
  82.                 printf("How many Column : ");                    
  83.                 scanf("%d", &ncol);
  84.                 // For each row, allocated ncol
  85.                 for (row_loop=0;row_loop<nrow;row_loop++)
  86.                 {
  87.                     rowptr[row_loop] = (int *)malloc(sizeof(int *) * ncol);
  88.                     if (rowptr[row_loop] == NULL)
  89.                     {
  90.                         perror("Dynamic Memory Allocation for column Fails");
  91.                     }
  92.                 }
  93.  
  94.                 for (row_loop=0;row_loop<nrow;row_loop++)
  95.                 {
  96.                     for (col_loop=0;col_loop<ncol;col_loop++)
  97.                     {
  98.                         printf("Enter the [%d][%d] number : ", row_loop, col_loop);
  99.                         scanf("%d", &rowptr[row_loop][col_loop]);
  100.                     }
  101.                 }
  102.                 break;
  103.             }
  104. // ------------------------------------------------------------
  105.             case 2:
  106.             {    // Enter the first matrix
  107.                 do
  108.                 {
  109.                     printf("Enter the First Matrix : \n");
  110.                     printf("How many Row : ");
  111.                     scanf("%d", &nrow);
  112.                     rowptr = (int **)malloc(sizeof(int **) * nrow);
  113.                     if (rowptr == NULL)
  114.                     {
  115.                         perror("Dynamic Memory Allocation for row Fails");
  116.                     }
  117.                     printf("How many Column : ");
  118.                     scanf("%d", &ncol);
  119.  
  120.                     for (row_loop=0;row_loop<nrow;row_loop++)
  121.                     {
  122.                         rowptr[row_loop] =(int *) malloc(sizeof(int *) * ncol);
  123.                         if (rowptr[row_loop] == NULL)
  124.                         {
  125.                             perror("Dynamic Memory Allocation for column Fails");
  126.                         }
  127.                     }
  128.  
  129.                     for (row_loop=0;row_loop<nrow;row_loop++)
  130.                     {
  131.                         for (col_loop=0;col_loop<ncol;col_loop++)
  132.                         {
  133.                             printf("Enter the [%d][%d] number : ", row_loop, col_loop);
  134.                             scanf("%d", &rowptr[row_loop][col_loop]);
  135.                         }
  136.                     }
  137. // -----------------------------------------------------------
  138.                     // Enter the second Matrix
  139.                     printf("Enter the Second Matrix : \n");
  140.                     printf("How many row : ");
  141.                     scanf("%d", &nrow_1);
  142.                     rowptr_1 = (int **)malloc(sizeof(int **) * nrow_1);
  143.                     if (rowptr_1 == NULL)
  144.                     {
  145.                         perror("Dynamic Memory Allocation Matrix 2 for row Fails");
  146.                     }
  147.                     printf("How many Column : ");
  148.                     scanf("%d", &ncol_1);
  149.  
  150.                     for (row_loop=0;row_loop<ncol_1;row_loop++)
  151.                     {
  152.                         rowptr_1[row_loop] = (int *)malloc(sizeof(int *) * ncol_1);
  153.                         if(rowptr_1[row_loop] == NULL)
  154.                         {
  155.                             perror("Dynamic Memory Allocation Matrix 2 for column Fails");
  156.                         }
  157.                     }
  158.  
  159.                     for (row_loop=0;row_loop<nrow_1;row_loop++)
  160.                     {
  161.                         for (col_loop=0;col_loop<ncol_1;col_loop++)
  162.                         {
  163.                             printf("Enter the [%d][%d] number : ", row_loop, col_loop);
  164.                             scanf("%d", &rowptr_1[row_loop][col_loop]);
  165.                         }
  166.                     }
  167.                     break;
  168.                 }while(symmetric == 0);
  169.             }
  170.         }
  171. // ------------------------------------------------------------
  172.         // Check the Dimension of Two Matrix
  173.         symmetric = Symmetric(nrow, ncol, nrow_1, ncol_1);
  174.         if (symmetric == 1)
  175.         {
  176.             printf("\nThe two Matrix is same dimension");
  177.         }
  178.         else
  179.         {
  180.             printf("\nThe two Matrix is different dimension");
  181.         }
  182.  
  183.            // Runtime Error
  184.         Add(rowptr, rowptr_1, nrow, ncol, nrow_1, ncol_1);
  185.         // Adding the element of matrix
  186. //        Display(result, nrow, ncol);
  187.         // Display the result after successful allocated the memory
  188.  
  189.         free(rowptr);
  190.         free(rowptr_1);
  191.         free(result);
  192.     }
  193.  
  194.  
  195.     return 0;
  196.  
  197. }
  198. // -----------------------------------------------------------
  199. int Symmetric(int nrow, int ncol, int nrow_1, int ncol_1)
  200. {
  201.     int symmetric;
  202.     if (nrow == nrow_1 && ncol == ncol_1)
  203.     {
  204.         symmetric = 1;
  205.         return symmetric;
  206.     }
  207.     else
  208.     {
  209.         symmetric = 0;
  210.         return symmetric;
  211.     }
  212. }
  213. // ------------------------------------------------------------
  214. void Add(int **rowptr, int **rowptr_1, int nrow,
  215.          int ncol, int nrow_1, int ncol_1)
  216. {    
  217.     int row_loop, col_loop;
  218.     int **result = NULL;
  219.  
  220.     nrow = nrow_1;
  221.     ncol = ncol_1;
  222.  
  223.     result= (int **)malloc(sizeof(int **) * nrow);
  224.  
  225.     for (row_loop = 0; row_loop < nrow; row_loop++)
  226.     {
  227.         result[row_loop] = (int *)malloc(sizeof(int *) * ncol);
  228.     }
  229.     if (result == NULL)
  230.     {
  231.         perror("Dynamic Memory Allocation for result Fails");
  232.     }
  233.  
  234.     for (row_loop = 0;row_loop < nrow; row_loop++)
  235.     {
  236.         for (col_loop = 0; col_loop < ncol; col_loop++)
  237.         {
  238. //            *(*(result + row_loop) + col_loop) =  (*(*(rowptr + row_loop) + col_loop))   +  (*(*(rowptr_1 + row_loop) + col_loop));
  239.              result[row_loop][col_loop]=rowptr[row_loop][col_loop]+rowptr_1[row_loop][col_loop];
  240.         }
  241.     }
  242.        Display(result,nrow,ncol);
  243.  
  244. }
  245.  
  246. // ------------------------------------------------------------
  247. void Display(int **result, int nrow, int ncol)
  248. {
  249.     int row_loop, col_loop;
  250.     // Loop for row and column
  251.  
  252.     for (row_loop = 0; row_loop < nrow; row_loop++)
  253.     {
  254.         for (col_loop = 0; col_loop < ncol; col_loop++)
  255.         {
  256.             printf("The value of array at [%d][%d] is %d\n", row_loop, col_loop, *(*(result + row_loop) + col_loop) );
  257.         }
  258.     }
  259.  
  260. }
  261.  
  262. // ------------------------------------------------------------ 
  263.  
  264.  
  265. Thanks
  266.  
Apr 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Nils | last post by:
Hi, I want to create a dynamic array with pointer, without allocation of the memory. I tried it so: objekt **ob= new objekt; It is not working, because he will parameter for the Konstructor...
11
by: D | last post by:
hi, i would like to know how to calculate the size of a dynamic array created using a dereference declaration like int *numbers and allocating via malloc or calloc: numbers=(int...
14
by: chai | last post by:
Can anyone help me in finding elements stored in a dynamic array in.
2
by: monkeydragon | last post by:
#define MAX_TABLE = 1024; BYTE* dynamic1D = new BYTE; later.. i want to create a dynamic 2d ARRAY like this: >] >] >]
14
by: romayankin | last post by:
Hello All, I'm writing cross-platform code so i'm bound to standards. Here is the code I have: ~~~~~~~~~~~~~~~~~~ double **mx = new double*; for(int i = 0; i < col - 1; i++) { mx = new...
4
by: Saul775 | last post by:
Hello, all: Just a general question that's been bothering me. Suppose I'd like to create a 2D array of integers -- not using the vector template -- but I need to dynamically create the array as...
5
by: vmohanaraj | last post by:
Hi, I have implemented a template class which encaptulates a 2d dynamic array. Basically the class looks like this: template <class T> class Dynamic2dArray { private:...
1
by: mrtcnr | last post by:
Hi everyone, I am new at programming. I was googling for how to create an 2d dynamic array. But I couldnt find what i want. I want to create an array which i will define during run time. For...
3
by: hn.ft.pris | last post by:
I've got following code test C++'s functor. For the sake of easy-reading, I omit some declearations. #include <algorithm> #include <functional> using namespace std;
2
by: Opteron64 | last post by:
Hi, I'm trying to create and initialise a dynamic array within a nested structure. The structure is defined as followed: (C++ code) typedef unsigned char uchar; typedef unsigned int uint; ...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.