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
What is volatile variable how do you declare it?
Explain how can I convert a string to a number?
what is the format specifier for printing a pointer value?
Can you tell me how to check whether a linked list is circular?
What is the basic structure of c?
What does *p++ do? What does it point to?
What are static variables in c?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
Explain what is a 'locale'?
What is optimization in c?
Explain what is the purpose of "extern" keyword in a function declaration?
What is typedef example?
Explain what are header files and explain what are its uses in c programming?
Mention four important string handling functions in c languages .
How can you tell whether two strings are the same?