From: Jonathan A. <jo...@jo...> - 2010-02-11 15:01:58
|
On Thu, 2010-02-11 at 09:43 -0500, Tatsh wrote: > In main, don't put void in your call. It needs to just be Multiply() with > arguments supplied. > > You can't expect this to work as a so-called 2D array MUST have its first > dimension (call it width) defined. If you want to have a multiply() function, > pass a pointer to malloc'd space like this: > > in main(): > int i; > int **A = (int **)malloc(nrows * sizeof(int *)); This is the kind of evil that gives C a bad name ! Double dereferenced pointers and a malloc, nasty. A more readable way is to malloc a buffer large enough, create a structure or array and then place the array pointer or structure member in the buffer. http://www-ee.eng.hawaii.edu/~tep/EE160/Book/chap12/subsection2.1.1.4.html |