What is the function pointer parameters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the function pointer parameters

thats mean what is the usage and how to use

16th Sep 2017, 3:49 PM
Vibeeshanan Vibee
Vibeeshanan Vibee - avatar
1 Answer
0
I'm not quite sure I understand the question, but I'll guess you're asking why would you use pointers instead of variables as function parameters. Well, at least in C, if you put a variable as parameter, it just copies the value, and a function can only return one value. Now imagine I have a character and I want to move its x and y possition in one function. The only way of doing that is passing those values as pointers. When the function changes those values, they Will not be a copy but the actual values because the pointers refference their memory adress. Was that your question or I missunderstood? If that's the case, could you be more specific?
24th Sep 2017, 5:59 AM
Qwerty