Hey guys,
Is there any limitation in the maximum memory allocated for arrays. Cos When i execute this program it is breaking in the allocation.
Here the row size is 735000, if the row size is small say 5000 it is working fine. It is having trouble for bigger size.
Thanks
Code:#include<stdio.h> #include<stdlib.h> int main() { int row,column; int **p; int i, j; row=735000; column = 5500; p = malloc( row * sizeof(int*) ); if(p != NULL) { for(i = 0; i < row; i++) { p[i] = malloc(column * sizeof (int)); if(p[i] == NULL) { printf("Memory allocation failed in Column: %d",i); printf(" \nExiting...."); return 1; } } } else { printf("Memory allocation failed in Row. Exiting...."); return 1; } for(i=0;i<row;i++) { for(j=0;j<column;j++) { p[i][j]=-1; printf("%d", p[i][j]); } printf("\n"); } return 0; }