Re: Passing structs....
"Robby" <Robby@discussions.microsoft.com> wrote in message
news:AB26AE17-BAF4-453F-93BD-B82A2568900A@microsoft.com
void f( int r, int TOUCHES)
{
PASSCODE *y;
y = malloc(sizeof(struct passCode));
y->TOUCHES = TOUCHES;
free(y);
y = NULL;
}
This function, of course, is equivalent to
void f( int r, int TOUCHES) {}
There's a lot of busywork that achieves precisely nothing. I fail to see
the point of the exercise.
Okay, This was hard for me to explain in previous posts because I was
very confused, but lets get some ground rules that I have to go by.
--- Rule #1 ----
I need a function (in this case f();) that contains 3 memory
operations.
They are:
a) It must create an object on the heap and imediately assign data to
its elements
b) It must be able to only modify the object's elements !
c) It must be able to free the object.
Does it absolutely have to be just one function? You have three largely
unrelated operations - why not have three functions performing them?
It's not like you are being charged per function or anything.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925