This is driving me nuts!!
i have the following code:
	
	
	
		
but it will not compile.
where am i going wrong? is there another way to make a dynamic 2d array in c?
oh, im using visual c++ - win32 Console application
	
		
			
		
		
	
				
			i have the following code:
		Code:
	
	#include "stdafx.h"
#include "malloc.h"
int **new2d(int n);
int main (){
int **array = NULL;
int n;
do {
	printf("Size of array (>0)?\n");
	scanf("%i", &n);
	} while (n<=0);
array = new2d(n);
}
int **new2d(int n){
	int **array;
	int i;
	
	array=malloc(n * sizeof *array);
	for (i=0; i < n; ++i){
		array[i] = malloc(n * sizeof *array[i]);
	}
	return array;
}but it will not compile.
on the malloc lineserror C2440: '=' : cannot convert from 'void *' to 'int **'
where am i going wrong? is there another way to make a dynamic 2d array in c?
oh, im using visual c++ - win32 Console application
 
	 
  
 
		 
 
		 
 
		 
 
		 
 
		


