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 volatile variable how do you declare it?

562


Explain how can I convert a string to a number?

643


what is the format specifier for printing a pointer value?

609


Can you tell me how to check whether a linked list is circular?

764


What is the basic structure of c?

553






What does *p++ do? What does it point to?

612


What are static variables in c?

627


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

642


Explain what is a 'locale'?

581


What is optimization in c?

562


Explain what is the purpose of "extern" keyword in a function declaration?

615


What is typedef example?

616


Explain what are header files and explain what are its uses in c programming?

623


Mention four important string handling functions in c languages .

619


How can you tell whether two strings are the same?

826