199k views
2 votes
Define a function UpdateTimeWindow() with parameters timeStart, timeEnd, and offsetAmount. Each parameter is of type int. The function adds offsetAmount to each of the first two parameters. Make the first two parameters pass by pointer.

User Tooluser
by
5.4k points

1 Answer

2 votes

Answer:

void UpdateTimeWindow(int* timeStart,int* timeEnd,int offsetAmount){

*timeStart=*timeStart+offsetAmount;

*timeEnd=*timeEnd+offsetAmount;

}

Step-by-step explanation:

here we are using 2 int pointers for the function UpdateTimeWindow() as we are passing addresses to pointer variables from main like below

(UpdateTimeWindow(&timeStart,&timeEnd,someValueforOffset)

the 2 pointers receives these int variables addresses and we are adding values of those locations to the offset

User David DeMar
by
5.0k points