malloc


memory reservation

malloc

p=malloc(n)

        Returns p of n floats.
Notes:
1) The reserved array is not initialized.
2) Allow large memory reservation:
w=[1,1000000]; overflows.
w=malloc(1000000); books a variable w of 1000000 floats.
3) To release a buffer initialized by buf=malloc(1000000) write: buf=NIL.
Options:
randf(r): for(i=0,n-1)p[i]=p[i]=randf(r););
rand2f(r1,r2): for(i=0,n-1)p[i]=p[i]=rand2f(r1,r2););
sin(f,p): for(i=0,n-1)p[i]=sin(f*i+p);
sin(f1,p1,f2,p2,...,fn,pn): for(i=0,n-1)pp[i]=sum(sin(fi*i+pi))/n;
Example:
w=malloc(100000); variable w may receive 100000 values.

See also:

calloc