Monday, March 30, 2015

What is the difference between the two files. file1.c# include...........int i;void main(){..........}file2.c# includestatic int i;void main(){....}

Question:What is the difference between the two files. file1.c# include...........int i;void main(){..........}file2.c# includestatic int i;void main(){....}?

Answer: </P><P>While in this case for both the programs... the scope and lifetime of variable &#39;i&#39; is throughout the program..... the value of &#39;i&#39; is not. For eg. if &#39;i=2&#39; 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 &#39;i&#39; is accessed from any other program its value will always be seen as 0</P><P>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.

Tags:Global Interview Questions, Kshema Technology, Technical,

Please submit your Interview Answer for the above Question via replying to this post. Thank you for visiting to our blog, Have a Good Day!.



Sponsor Advertisement



Hospital Management Software

Hotel Management System Software

Hotel Management System software is a web based system help to manage reservations, roomstays, bookings, guests, folios, invoices and billing etc. The software features include revenue management, booking calendar, guest relationship management, check-in & check-out, invoices and receipts etc...

No comments:

Post a Comment