Technology has become such a major part of everyday life
Answer:
Here is a UpdateTimeWindow() method with parameters timeStart, timeEnd, and offsetAmount
// the timeEnd and timeStart variables are passed by pointer
void UpdateTimeWindow(int* timeStart, int* timeEnd, int offsetAmount){
// this can also be written as *timeStart = *timeStart + offsetAmount;
*timeStart += offsetAmount; //adds value of offsetAmount to that of //timeStart
// this can also be written as *timeEnd = *timeEnd + offsetAmount;
*timeEnd += offsetAmount; } //adds value of offsetAmount to that of //timeEnd
Explanation:
The function has three int parameters timeStart, timeEnd, and offsetAmount.
First two parameters timeStart and End are passed by pointer. You can see the asterisk sign with them. Then in the body of the function there are two statements *timeStart += offsetAmount; and *End+= offsetAmount; in these statements the offsetAmount is added to the each of the two parameters timeStart and timeEnd.
Answer:
#include <stdio.h>
int main()
{
int x;
float y;
printf("Input total distance in km: ");
scanf("%d",&x);
printf("Input total fuel spent in liters: ");
scanf("%f", &y);
printf("Average consumption (km/lt) %.3f ",x/y);
printf("\n");
return 0;
}
Answer:
Messages can be sent from other parts of your program.
The 'When receive message...' block allows you to receive those messages and start another part of your program. That way you can even have parts of you program run in parallel.