CrazyEngineers
  • Basic C++ question about pointers/structures

    LCD_Display

    Member

    Updated: Oct 11, 2024
    Views: 1.8K
    In the book that I am using they use two notations for calling structure data members when using pointers.


    (*pt).payRate * (*pt).hours ;
    (pt ->payRate * pt ->hours);

    I understand that in the first line * is dereferencing the pointer so that I can retrieve the data in the address stored in the pointer variable.

    I know the second line gives me the same answer as the first but not sure how. Is the second line a short cut, or is it retrieving data differently than the first line?

    Thanks in advance.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register