Tutor profile: Imane C.
Conjugue le verbe devoir au passé antérieur.
j'eus dû tu eus dû il/elle eut dû nous eûmes dû vous eûtes dû ils/elles eurent dû
Subject: Computer Science (General)
What is the difference between passing a variable by value and passing it by reference?
When a variable is passed by value to a function, as the name indicates, only its value is sent to the function. The function will thus have a copy of the variable and not the variable itself. In technical terms, this means that the function will allocate enough memory space (depending on the type of the variable) to store its own copy of the value. If the variable is modified within the scope of the function, only the value of the local copy is modified and not the variable itself. This entails that in order to "save" the modification, the variable needs to be returned to the calling function so that the change is visible to the latter. When a variable is passed by reference however, its address is sent to the function. This entails that the function receiving it does not have to create its own local copy (no new memory allocation is necessary), since it has the address (the reference) to the variable. Having the address means that the receiving function can directly make the needed changes to the original memory location where the variable resides. It does not need to return anything, since the variable was changed permanently.
What is Doppler's effect?
An example of the Doppler's effect that you have probably experienced in your life is the sound of a police car sirens or an ambulance while it was driving towards you or away from you. This is due to the change of frequency that the sound waves are subject to. This change in frequency occurs when the distance between the source (the car or ambulance) and the observer (the person hearing the sound) is changing, causing the sound to be different than the one originally produced. Clearly, if the source and observer are both standing still, the sound that is sent by the source will be the same as the one received by the observer. The Doppler's effect can also change the way we perceive light. Since light is itself a wave, if the source producing it is moving the wave can be distorted as well, causing the light to be seen by the observer with a different color (since colors are characterized by frequencies).
needs and Imane will reply soon.