KEMBAR78
3 D Array | PDF
0% found this document useful (0 votes)
7 views2 pages

3 D Array

The document contains a code snippet that allocates memory for a 3D array of strings named 'Books'. It uses nested loops to allocate memory for each dimension of the array based on the variables 'noBooks', 'row', and 'col'. The code ensures that enough memory is allocated for each string in the array.

Uploaded by

ananya s
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

3 D Array

The document contains a code snippet that allocates memory for a 3D array of strings named 'Books'. It uses nested loops to allocate memory for each dimension of the array based on the variables 'noBooks', 'row', and 'col'. The code ensures that enough memory is allocated for each string in the array.

Uploaded by

ananya s
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Books = (char ***)malloc(sizeof(char **)*noBooks);

for(i=0;i<noBooks;i++){
Books[i] = (char **)malloc(sizeof(char*)*row);
for(j=0;j<row;j++)
{
Books[i][j] = (char *)malloc(sizeof(char)*col);
}
}

You might also like