I have the function and main
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
setArray(double *thearray){
*thearray[0][0] = 2.0;
*thearray[0][1] = 2.0;
*thearray[1][0] = 2.0;
*thearray[1][1] = 2.0;
}
void main(){
double myarray[2][2];
setArray(&myarray);
}
I cannot specify the size of array on setArray function because I don't know what will it be. I need to fill up the array in this specific fucction but I can't. get errors:
test.c: In function ‘setArray’:
test.c:8:13: error: subscripted value is neither array nor pointer nor vector
test.c:9:13: error: subscripted value is neither array nor pointer nor vector
test.c:10:13: error: subscripted value is neither array nor pointer nor vector
test.c:11:13: error: subscripted value is neither array nor pointer nor vector
test.c: In function ‘main’:
test.c:16:1: warning: passing argument 1 of ‘setArray’ from incompatible pointer type [enabled by default]
test.c:7:1: note: expected ‘double *’ but argument is of type ‘double (*)[2][2]’
setArray(myarray)