InterviewSolution
Saved Bookmarks
| 1. |
Discuss the similarities and difference between global and local variables in terms of their lifetime and scope. |
||||||||
Answer»
Example: #include <iostream.h> float NUM=900; //NUM is a global variable void LOCAL(int T) { int Total=0; //Total is a local variable for (int I=0;I<T;I++) Total+=I; cout<<NUM+Total; } void main() { LOCAL(45); } |
|||||||||