Advertisement
pai

C- Memory allocation_Method

pai
Feb 20th, 2012
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. //Allocating a 2D array using double pointer
  2. long int **key_column;
  3. key_column=(long int **)malloc(sizeof(int long *)*num_of_lines);
  4.         if(key_column==NULL)
  5.         {
  6.             printf("\nNo host memory for the key elelments:");
  7.             exit(0);
  8.         }
  9.         for(k=0;k<num_of_lines;k++)
  10.         {
  11.             key_column[k]=(long int *)calloc(MAX_LIMIT,sizeof(long int));
  12.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement