Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   doubt in multiple choice questions in C (http://www.go4expert.com/forums/doubt-multiple-choice-questions-c-t6231/)

sudheer157 6Sep2007 20:28

doubt in multiple choice questions in C
please tell me the sol to this Question

int **make_matrix(int *m,int *n,int mlen,int nlen)
int j,k;
int **matrix=malloc(mlen*nlen*sizeof(int));


return matrix;

function make_matrix defined above contains a serious error.which of the following describes the error.

1.C does not allow creation of multidimwntiona arrays.
2.Tha call to malloc() allocates insufficient space to accommodate the correct number of elements.
3.Inside make_matrix dereferences random memory address,resulting in undefined behaviour.
4.C uses row-major indexing rather than column -major indexing.The logic used to compute indices is therefore incorrect.
5.internal algorithms of make_matrix() consistantly result in memory leak.

shabbir 6Sep2007 21:03

Re: doubt in multiple choice questions in C
Split the thread from 100 Multiple choice questions in C because the question is not at all part of the questionnaire.

All times are GMT +5.5. The time now is 15:58.