Friday, July 31, 2009

In C, How do I create an array of 360 floats using calloc (or malloc), and check the memory has been...?

allocated ok?





Also how do I populate this array with a series of sin values, where the angle stored is the element of the array?, i.e





f[0] = sin(0);


f[1] = sin(1);





for the output I need to display the values on the screen





Many Thanks for your help :)

In C, How do I create an array of 360 floats using calloc (or malloc), and check the memory has been...?
float *arr;


int i;


arr = malloc(sizeof(float) * 360);


for (i=0; i %26lt; 360; i++)


arr[i] = sin(i);

pansy

No comments:

Post a Comment