Originally Posted by
itCbitC
define ArrB as an object of type int**, allocate it dynamically, and then assign to it
I'm sorry, but I've never used objects. How exactly does this work? I didn't think I could allocate dynamically in C.
Edit: Would it also be possible to just use realloc? I'd only be able to access this as a 1D array, right?
Code:
ArrB = (int*) realloc (ArrB, (N)*65 * sizeof(int));
Here is what I have so far (just for debugging):
Code:
#include <stdio.h>
#include <stdlib.h>#define WIDTH 5
#define loc(r,c) (((r-1)*WIDTH)+(c-1))
}
int main(){
int CP[5] = {6,7,8,9,10};
int AP[loc(3,5)+1] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
AP = (int*) realloc(AP, sizeof(AP)+sizeof(CP));
}
But I am getting the error "error: incompatible types in assignment of `int*' to `int[15]'." What does this mean? I thought I have everything cast correctly.