If you have a struct (or in C++ a class), you use these operators to access
the members of that struct (or object). If the object is a pointer to an
object then you need to use the arrow (->) indirection. If the object is the
actual object (if you see what I mean) then you need to use the dot.

typedef struct error_code_struct
    int  bytes_provided;
    int  bytes_avail;
    char expt_id[7];
    char RESERVED;
    char expt_data[100];
} Error_Code_Struct;

Error_Code_Struct  err_code;
Error_Code_Struct  *perr_code;

main() {

  printf("Bytes Provided = %i\n", err_code.bytes_provided);

  perr_code = &err_code;      /* Get the reference (pointer) to err_code */

  printf("Bytes Provided = %i\n", perr_code->bytes_provided);


In C++:

Class FooBar {
        int Value;

Foobar aFoo;
Foobar *aBar;

main () {

        printf("Value = %i\n", aFoo.Value);

        aBar = new Foobar();

        printf("Value = %i\n", aBar->Value);


-----Original Message-----
From: Gene_Gaunt@ReviewWorks.com [mailto:Gene_Gaunt@ReviewWorks.com]
Sent: 26 July 2002 13:28
To: C400-l@midrange.com
Subject: [C400-L] dot-indirection and arrow-indirection operators?

What are dot-indirection and arrow-indirection operators?   They appear in
WDS C/C++ Language Reference chapter 5's operator precedence and
associativity table under rank level "4":

object .* ptr_to_member

object ->* ptr_to_member

This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/c400-l
or email: C400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].