C Programming Question Consider the following function void
C Programming Question
Consider the following function:
void translate(int *px, int *py, int dx, int dy) {
*px = dx + *px;
*py += dy;
}
Which of the following statement(s) are correct ?
py is an input parameter
px is an in-out parameter
dx is an input parameter
px is an out parameter
py is an in-out parameter
| py is an input parameter | ||
| px is an in-out parameter | ||
| dx is an input parameter | ||
| px is an out parameter | ||
| py is an in-out parameter |
Solution
Answer:
Below statements are correct.
py is an in-out parameter
px is an in-out parameter
dx is an input parameter
py and px are pointer variables so if we do any changes in them, these changes will reflect on original copy of that variable where it is being called
