Difference between terms

can you tell me exactly the difference between scope lifetime and visibility?

The scope of a variable is the part of the program within which the variable can be used. So, the scope describes the visibility of an identifier within the program.
it is either local or global i.e. only accessible by a fixed function or a accessed by everything

The lifetime of a variable or function is the time duration for which memory is allocated to store it, and when that memory is released. It also refered as extent of a variable.
when u define a variable, it gets allocated in the memory, at some later stage when it is released from the memory it’s lifetime ends
The lifetime of a variable is the time during which the variable stays in memory and is therefore accessible during program execution. The variables that are local to a method are created the moment the method is activated (exactly as formal parameters) and are destroyed when the activation of the method terminates.

hey @Raghavsingla522 if your doubt is solved, please mark it as resolved

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.