Conceptual problem.

Discussion in 'C' started by pkbis28, May 31, 2010.

  1. pkbis28

    pkbis28 New Member

    Joined:
    May 25, 2010
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    What am I allowed to assume about the initial values
    of variables which are not explicitly initialized?
     
  2. singh_r85

    singh_r85 New Member

    Joined:
    May 25, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    Uninitialized variables with "static" duration start out as 0,
    as if the programmer had initialized them. Variables with
    "automatic" duration, and dynamically-allocated memory, start
    out containing garbage (with the exception of calloc).
     
  3. ksrao

    ksrao New Member

    Joined:
    Aug 10, 2010
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    0
    Hi,
    Always the best practice is to initialize the variables, otherwise they will take garbage values.i.e the previous or un-attended values which are present in that present memory location.

    Regards
    Kolla SanjeevaRao
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice