dimanche 21 septembre 2014

Initialize an array with copy


Vote count:

0





[Example:


consider int x[3][5];


Here x is a 3 × 5 array of integers. When x appears in an expression, it is converted to a pointer to (the first of three) five-membered arrays of integers. In the expression x[i] which is equivalent to *(x+i), x is first converted to a pointer as described; then x+i is converted to the type of x , which involves multiplying i by the length of the object to which the pointer points, namely five integer objects [...]



Since the type of x is an "array of 3 arrays of 5 integers" we have that x+i too. Assume that i = 2;


What is the value of the x + i (Call him arr) elements after convertion to array of 3 arrays of 5 integers? I mean what arr[3] equals to?



asked 34 secs ago







Initialize an array with copy

Aucun commentaire:

Enregistrer un commentaire