1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

typedef error

Discussion in 'C' started by phiber_optik, Feb 10, 2008.

  1. phiber_optik

    phiber_optik New Member

    Joined:
    Feb 10, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    typedef int T;
    main()
    {
    T T=5; //no error
    }

    but in the following case, I get an error
    main()
    {
    typedef int T;
    T T=5; /error
    }
     
  2. Lucius

    Lucius New Member

    Joined:
    Feb 10, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    typedef int T; // define global symbol 'T'
    int main()
    {
      T            // use global symbol 'T'
        T          // declare local symbol 'T' that
                   // from this point on "shadows" the
                   // global 'T' which main can no
                   // longer access.
                   // E.g.,  T S = 7; is an error
           = 5;    // ...
    }
    
    Code:
    int main()
    {
      typedef int T; // define local symbol 'T'
      T T = 5;       // re-define local symbol 'T' (error)
    }
    
     

Share This Page