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 static memory allocation?
Why is structure important for a child?
Is it possible to execute code even after the program exits the main() function?
What do you mean by dynamic memory allocation in c?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
which is an algorithm for sorting in a growing Lexicographic order
How can you restore a redirected standard stream?
What is meant by realloc()?
How can I invoke another program or command and trap its output?
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
What are run-time errors?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
List the variables are used for writing doubly linked list program.
How is null defined in c?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd