-
December 24th, 2003, 03:37 PM
#1
Call function with pointers
Hi. Suppose I want to implement a function like this:
void function_name(int length, short *array)
{
array = (short*)malloc(sizeof(short)*length);
....
....
}
This unfortunatelly doesn't work. To work I must place the allocation line (array = (short*)malloc(sizeof(short)*length)
in my main(), just before calling the function.
Why is this happening?
Thanx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|