-> operator

This is a discussion on -> operator within the C Programming forums, part of the General Programming Boards category; am i correct in understanding that the _> operaor will work in the following way [code] pt_ptr _>y = pt_ptr->y ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    70

    -> operator

    am i correct in understanding that the _> operaor will work in the following way

    [code]

    pt_ptr _>y = pt_ptr->y - 3.0;

    decreases the value of element y in sturture pointed by pt_ptr by 3

  2. #2
    Registered User
    Join Date
    May 2004
    Posts
    127
    Assuming pt_ptr is a pointer to a structure that defines a y member and actually points to something, and that the y member is an arithmetic type (probably double), yes. It does what you think. But when typing the arrow operator, be careful that you don't hold the shift key down until the second half of the token. _> is a syntax error.
    When writing a specialization, be careful about its location; or to make it compile will be such a trial as to kindle its self-immolation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Overloading -> operator
    By Hunter2 in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2004, 03:08 PM
  4. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:51 PM
  5. -> operator and its uses and benefits
    By supaben34 in forum C++ Programming
    Replies: 3
    Last Post: 11-04-2002, 02:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21