while initialization of two dimensional arrays we can
initialize like a[][2] but why not a[2][] is there any
reason behind this?

Answer Posted / kathir

Lets assume an arry arr[][3] = {..};
if you want to refer arr[1][2] then the reference to the
element will be identified using the following formula,
arr[1*NoOfColoumns(=3) + 2](you can consider it as a single
dimension array storing values in sequence).
Hence to get the address of any element in the array you
only require column info NOT rows.Thats why compiler does
not bother about no of rows!

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between volatile and const volatile?

573


How are pointers declared in c?

603


What is line in c preprocessor?

618


What is double pointer?

563


Why is c still so popular?

621






What are the two types of functions in c?

576


Explain what does the format %10.2 mean when included in a printf statement?

786


What are structure members?

601


List some of the dynamic data structures in C?

794


Calculate 1*2*3*____*n using recursive function??

1522


What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?

823


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1478


What is a pointer on a pointer in c programming language?

625


What is the use of header files?

612


Mention four important string handling functions in c languages .

634