|
-
Mar 17th, 2001, 06:04 PM
#1
Thread Starter
Addicted Member
I have a two dim array that I created using pointers:
int row;
int **temp;
temp = (int **) calloc (10, sizeof(int));
for (row=0; row <10; ++row)
temp[row] = (int *) calloc (10, sizeof (int));
but I need to use a pointer in this last line instead of temp[row] any idea how?
-
Mar 17th, 2001, 06:15 PM
#2
Monday Morning Lunatic
Use (*(temp + (row * sizeof(temp[0]))). One other thing though, you need to make sure that you're using proper sizes, so your first call to calloc should be:
temp = (int **)calloc(10, sizeof(int*));
...since it's a pointer.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|