Click here to Skip to main content
12,632,477 members (34,042 online)
Click here to Skip to main content
Alternatives (1)
Add your own
alternative version

Tagged as

Stats

24.4K views
4 bookmarked
Posted

Declare a reference for a two dimensional array without typecasting

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

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

3 Jan 2012
kooyou
The second form is wrong. A two dimensional pointer does not equal to a two dimensional array. But you can use an one dimensional pointer to reference the two dimensional array.int arr[1][20];int *pTwoDem=(int*)arr;Now you can use *(pTwoDem+10) to replace arr[0][10].

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mukit, Ataul
Chief Technology Officer Rational Technologies
Bangladesh Bangladesh
If you are not in - you are out !
- Chapter 1

| | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 25 Dec 2011
Article Copyright 2011 by Mukit, Ataul
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid