Understanding multidimensional arrays in c++

Status
Not open for further replies.

chesss

mera kutch nahi ho sakta
Heres a simple multi array - char c[10][10] = {"sunday", "monday"};

now my question is, in this case what will be c[0] or c[1] ? and what are their types ?

Please think and answer.
 

krishnandu.sarkar

Simply a DIGITian
Staff member
As far i knw multi-D arrays can't b accessed in a single-D array......
But as ths is a char array it may b 's' in c[0]

correct me if i'm wrong...!!
 
OP
chesss

chesss

mera kutch nahi ho sakta
But as ths is a char array it may b 's' in c[0]
well I can't be sure, but I think that c[0] is the name/identifier of an array, since the name of an array c[0] allow acts like a pointer, it stores the address of of the first element c[0][0].
 

Liverpool_fan

Sami Hyypiä, LFC legend
Heres a simple multi array - char c[10][10] = {"sunday", "monday"};

now my question is, in this case what will be c[0] or c[1] ? and what are their types ?

Please think and answer.

c[0] -> "sunday"
c[1] -> "monday"

c[0][0] -> 's' and so so
c[1][0] -> 'm' and so on
 
Status
Not open for further replies.
Top Bottom