| | |
2d address calculation
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2005
Posts: 31
Reputation:
Solved Threads: 0
plz give me links or discuss on address calculation in 2d arrays.
i have little knowledge of calculating the address. can any one give some formula or something coz my professor gave it but i wasnt able to follow . i remember he was using terms like rowmajor, column major, lower base , upper base etc.
so if any one is having knowledge plz help as this topic is not even in the book that i am using ( the course book i mean).
i have little knowledge of calculating the address. can any one give some formula or something coz my professor gave it but i wasnt able to follow . i remember he was using terms like rowmajor, column major, lower base , upper base etc.
so if any one is having knowledge plz help as this topic is not even in the book that i am using ( the course book i mean).
In C and C++, arrays are stored in memory by row. That is, all the columns of the first row appear first, then all the columns of the second row, etc. If you have an int array with 2 rows and 5 columns then the location of any given row can be caluculated by this formula
C++ Syntax (Toggle Plain Text)
int *p = array + ((row_numer-1) * NumColumns)
C++ Syntax (Toggle Plain Text)
int array[2][5]; // set a pointer at the beginning of row 2 int* ptr = (int*)array + (1*5);
![]() |
Similar Threads
- Windows Explorer Issue: my "Address" bar is gone, how do I get it back? (Windows NT / 2000 / XP)
- remote pc problems (Networking Hardware Configuration)
- IE 6.0 doesn't show address bar, pull-down menu and shortcut icons when opened (Web Browsers)
- IE 6.0 doesn't show address bar, pull-down menu & short-cut icons when opened (Windows NT / 2000 / XP)
- Saving Address book and Messages in Outlook Express (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: recursive linked list
- Next Thread: Easy Polymorphism Q Part 2 :)
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






