C: Passing array to function vs. passing a POINTER to the same array
Posted on 2012-08-14
I'm telling myself the following MUST be OK but have a nagging doubt so I want to be sure. :)
1. SupposeI have a structure: CUSTOMER
and an array: (Global to my C file)
2. I then have (local to function in the same C file):
CUSTOMER *PtrPeople = People;
3. Now I have a called functon whose header is:
void ProcessStuff (PEOPLE *ppl)
4. My exis ting code (which someone else wrote) has the following calls:
ProcessStuff(People); // call #1, using the array
ProcessStuff(PtrPeople); // call #2 using the ptr to the array.
From what I recall, these should be one and the same since I'm dealing with an ARRAY,
but would appreciate either confirmation or correcting me if I'm wrong.