Forum

Global Variables V/S Static Variables

This thread contains 1 reply, has 2 voices, and was last updated by Nitesh User Do not delete 5 years, 10 months ago.

  • Author Replies
    • #53266

      What Is The Difference Between Global Variables And Static Variables?


    • #53268

      The extent of the variable depicts that the variable is accessible at a certain point in the program or not. The contrast between global variables and static variables lies in this idea as it were.

      Global variables:

      1) Global variables are put away in the Data Segment of the procedure.

      2) Global variable’s life is until the life of the program and it very well may be gotten to by different files utilizing extern keyword.

      3) The extent of the global variables stays all through the program likewise the life expectancy of these factors is all through the program.

      Static variables:

      1) A static variable can be proclaimed outside all functions or inside a function utilizing a static keyword before the data type of variable.

      2) The extent of the static Variables stays inside the block of code in which they are made yet the life expectancy stays all through the program.

      Along these lines, the fundamental distinction is between the scope of both types of variables.


      Regards,
      Nitesh Bavishiya

Viewing 1 reply thread

You must be to reply to this thread.Please or . Registration is 100% free.

GET FREE CONSULTATION

Call Us Now For Free Consultation97370 05566

Our experts listen to you patiently and suggest you the right course after conducting a personality profile test. Register your interest below to schedule personality profile test for you.

SUBSCRIBE TO OUR NEWSLETTER

Subscribe to get latest updates regarding courses, IT industry and career prospects.

Copyright 2016-2024 Smart Mentors. All Rights Reserved.

Login

FORGOT PASSWORD

Sign up now to Become An Instructor

    Register your Interest

      cf7captchaRegenerate Captcha