array function

Namal via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 31 04:24:32 PDT 2015


Hello,

can someone explain to me please what I am doing wrong by passing 
an integer to this function and then just creating a static 
array? The error I get is:

Error: variable N cannot be read at compile time

int[] foo(int N){


	int[N] v;
	//do something with it
	int[] s;
	return s;
}

void main(){

	int N = 12;
	int[] A;
	A=prim_numbers(N);

}


More information about the Digitalmars-d-learn mailing list