65.9K
CodeProject is changing. Read more.
Home

Declare a reference for a two dimensional array without typecasting

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.67/5 (3 votes)

Nov 30, 2011

CPOL
viewsIcon

33479

This not so useful tip tells you how to declare a reference for a two dimensional array without needing to use typecasting.

int x[1][20];
int (*p)[20] = x;
Here p has become a reference to x. Usually in most cases, we use:
int** p = (int**) x;
So, this tip gives you a hint about how to declare another reference for x without typecasting.