GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Kshema Technology  >  Technical
Go To First  |  Previous Question  |  Next Question 
 Technical  |  Question 4 of 18    Print  

What is the difference between the two files.

file1.c

# include...........

int i;

void main()

{

..........

}

file2.c

# include

static int i;

void main()

{

....

}

While in this case for both the programs... the scope and lifetime of variable 'i' is throughout the program..... the value of 'i' is not. For eg. if 'i=2' in the file1.c, any other program accessing this variable from outside will still see the value of i as 2. Whereas in File2.c if the variable 'i' is accessed from any other program its value will always be seen as 0

Reason: For static variables their values are active only within the COMPILE AREA of where it is declared or in the program where it is declared.


  
Total Answers and Comments: 0 Last Update: N/A   
  
 Sponsored Links

 

No answers are posted for this question yet.
Be the first to answer it!


 Related Questions

++i is a single instruction while in i=i+1, first i+1 is computed and then assigned.  

What is the difference between the two files. file1.c# include...........int i;void main(){..........}file2.c# includestatic int i;void main(){....}
While in this case for both the programs... the scope and lifetime of variable 'i' is throughout the program..... the value of 'i' is not. For eg. if 'i=2' in the file1.c, 


4.Is the following code an Example of Dynamic Binding Explain? class Base{Public:virtual Bool Dosomething()------------------};class Derived1: public Base{Public:Bool Dosomething();---------------------------------};class Derived2: public Base{Public:Bool Dosomething();---------------------------------};void main(){Derived1 derived1;Derived2 derived2;::process(derived1);::process(derived2);}::Process(Base& Object){Object.Dosomething();}What will happen if in the above code in the base class


 Sponsored Links

 
Related Articles

Business Intelligence in Information Technology

Business Intelligence in Information Technology IT stands for Information Technology Information Technology is a system designed to gather process or distribute information IT can be inspected in terms of the following three groupings; the data gathering the data processing and the data distribut
 

C++ Void Pointer and Null Pointer

C Void Pointer and Null Pointer In this C tutorial you will learn about two interesting types of pointers; void pointers and Null Pointer These pointers will be discussed in conjunction with syntax usage and example mosgoogle center Pointer to Void General Syntax void pointer variable; Void is use
 

C++ Static Functions

C Static Functions Static member functions have a class scope and they do not have access to the this pointer of the class When a member is declared as static a static member of class it has only one data for the entire class even though there are many objects created for the class The main usage of
 

Web Services and Client Server Technology

Web Services and Client Server Technology Introduction to Distributed Computing The Internet and expanded network connectivity established client sever models as the preferred form of distributed computing When talking about Client Server models of networked communication using web services the broa
 

What is 2.5G Technology

2.5G, which stands for "second and a half generation," is a cellular wireless technology developed in between its predecessor, 2G, and its successor, 3G. "2.5G" is an informal term, invented solely for marketing purposes, unlike "2G" or &qu
 

What is 2G Technology

2G refers to second generation wireless telecommunication technology. While its predecessor, 1G, made use of analog radio signals, 2G uses digital radio signals. Based on what type of multiplexing (the process of combining multiple digital data streams into one signal) is employed, 2G technologies m
 

What is Centrino Technology

Centrino is a platform-marketing initiative developed by the company Intel. It is a label used for a set of technologies for the central processing unit (CPU), mainboard chipset and wireless network interface, the usage of which, according to Intel, would provide broad wireless network interoperabil
 

How is the main() function declared?

The declaration of main can be done as int main() One more declaration that can be taken by main is command line arguments form int main(int argc, char *argv[]) or this can also be written as int main(argc, argv) int argc; char *argv[]; NOTE: It is not possible for one to declare the main
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(“%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is   &n
 

What is difference between call by value and call by reference in function?

The arguments passed to function can be of two types 1. Values passed 2. Address passed The first type refers to call by value and the second type refers to call by reference. For instance consider program1 main() { int x=50, y=70; interchange(x,y); printf(“x=%d y=%d”,x,
 

Related Categories
Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape