Monday, May 24, 2010

Can anyone write following in c language?

Write a function named allocAndInit() that will receive the following parameters: An int containing the number of doubles to create dynamically, and a double that contains the initial value that every item in the new memory will be initialized to. The function returns a pointer to the newly created data. It may not be a void pointer.

Can anyone write following in c language?
double * allocAndInit(int n, double value) {


double *value = (double*)malloc(n*sizeof(double);


return value;


}

lady palm

No comments:

Post a Comment