Click here to Skip to main content
15,919,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralAbout scrollbars Pin
n_a12-Nov-04 8:43
n_a12-Nov-04 8:43 
GeneralRe: About scrollbars Pin
n_a12-Nov-04 23:14
n_a12-Nov-04 23:14 
GeneralHelp me speed this up! Pin
Nitron2-Nov-04 8:36
Nitron2-Nov-04 8:36 
GeneralRe: Help me speed this up! Pin
Joaquín M López Muñoz2-Nov-04 9:13
Joaquín M López Muñoz2-Nov-04 9:13 
GeneralRe: Help me speed this up! Pin
Nitron2-Nov-04 9:21
Nitron2-Nov-04 9:21 
QuestionHow to Declare program, Menu and Dialog Pin
Dody_DK2-Nov-04 8:32
Dody_DK2-Nov-04 8:32 
GeneralRe: func to create 2-d array in C Pin
Joaquín M López Muñoz2-Nov-04 8:26
Joaquín M López Muñoz2-Nov-04 8:26 
GeneralRe: func to create 2-d array in C Pin
Budric B.2-Nov-04 8:34
Budric B.2-Nov-04 8:34 
To add to the previous poster's comments:
You are passing the copy of a pointer to pointer to int (int **). So when you are allocating space and saving the address, you're saving this address in a copy of the variable a, which has nothing to do with your a.

To solve this you need to either return the newly created array from your function by rewriting it as
int ** CreateArray(int i, int j)

Or you need to pass pointer to pointer to pointer to int (int ***) and set the value like this:
<br />
<br />
void CreateArray(int ***array,const int i,const int j)<br />
{<br />
*array = calloc (i, sizeof(int *)); //this allocates the first dimension<br />
loop<br />
  *array[i] = calloc(...); //this goes inside your loop<br />
end loop<br />
}<br />


In your place I'd return the value instead of using int ***.
GeneralRe: func to create 2-d array in C Pin
act_x2-Nov-04 8:40
act_x2-Nov-04 8:40 
Generalfunc to create 2-d array in C Pin
act_x2-Nov-04 8:13
act_x2-Nov-04 8:13 
General&quot;cout&quot; and &quot;cin&quot; won't work Pin
Verolix2-Nov-04 7:25
Verolix2-Nov-04 7:25 
GeneralRe: &quot;cout&quot; and &quot;cin&quot; won't work Pin
Joaquín M López Muñoz2-Nov-04 8:19
Joaquín M López Muñoz2-Nov-04 8:19 
GeneralRe: "cout" and "cin" won't work Pin
Verolix2-Nov-04 9:59
Verolix2-Nov-04 9:59 
GeneralRe: &quot;cout&quot; and &quot;cin&quot; won't work Pin
Joaquín M López Muñoz2-Nov-04 10:07
Joaquín M López Muñoz2-Nov-04 10:07 
GeneralRe: &quot;cout&quot; and &quot;cin&quot; won't work Pin
Verolix2-Nov-04 10:15
Verolix2-Nov-04 10:15 
GeneralMoving Horz ScrollBar Pin
manosza2-Nov-04 6:52
manosza2-Nov-04 6:52 
Generalpreferences in registry Pin
ehh2-Nov-04 6:37
ehh2-Nov-04 6:37 
GeneralRe: preferences in registry Pin
BlackDice2-Nov-04 6:46
BlackDice2-Nov-04 6:46 
GeneralRe: preferences in registry Pin
David Crow2-Nov-04 6:56
David Crow2-Nov-04 6:56 
GeneralRe: preferences in registry Pin
Blake Miller2-Nov-04 7:46
Blake Miller2-Nov-04 7:46 
GeneralRe: preferences in registry Pin
ehh3-Nov-04 6:47
ehh3-Nov-04 6:47 
GeneralSchool projects Pin
Izaquad2-Nov-04 6:29
Izaquad2-Nov-04 6:29 
GeneralRe: School projects Pin
David Crow2-Nov-04 6:57
David Crow2-Nov-04 6:57 
GeneralRe: School projects here is my code Pin
Izaquad2-Nov-04 7:32
Izaquad2-Nov-04 7:32 
GeneralRe: School projects here is my code Pin
David Crow2-Nov-04 7:52
David Crow2-Nov-04 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.