Results 1 to 8 of 8

Thread: -> and dot

  1. #1

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    -> and dot

    I have a book that I am learning from and I am confused as when I should use the -> or the "."(dot)

    also how do I know all the things I can put on the right side of a ->
    is there an object browser like VB?
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Use the dot when you are referencing a variable name.
    Use the -> when are using an indirect (pointer) reference.

    Code:
    struct complex {
           double r;
           double i;
    } a;
    
    void mm(void){
           a.i=1;
           a.r=(-1);
           display(&a);
    }
    
    void display(struct complex *ptr){
               printf("(%d,%d)\n",ptr->r,ptr->i );
               return;
    }

  3. #3

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    lets say the source code is huge how would you know that
    ptr->r
    is even available. Is there a more user friendly way to find out what my choices are?
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

  4. #4
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    You're thinking of the IDE in VB that does autocompletion.

    In C you split modules into different source files, and put struct declarations into header files. You can open any header file and browse. Keep module size down to 300-400 lines at most.
    Keep your functions restrained to doing just a few things.

    FWIW - one VB statement often becomes dozens of lines of C++ code. CreateObject, for example is like this.

    C works on a level that is far lower than VB - giving you more control and more work to do in coding.

  5. #5

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    Thank you for your help.
    I will try to read through the header files.
    I am programming for AutoCAD and the header files
    were written by AutoDesk, the makers of AutoCAD

    they call their collection of headers and libraries ObjectARX.

    the problem is there are thousands of these itemms.


    Thank you again for your help,
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Visual C++ has an auto-completion feature, but it doesn't always work.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    badgers -- This is why there are manuals for large SDKs.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Right. Nothing like a good (maybe online and cross-referenced) reference.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width