Thread: question

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    62

    question

    i have a few question that i dont understand please look in my code


    Code:
    #include<stdio.h>
    #include<conio.h>
    struct xxx
    {
           int aa;
           double bb;
    };
    
    main()
    {
    struct xxx mm; 
    struct xxx *pp;
    mm.aa=8;
    mm.bb=23.2;
    
    pp=&mm;
    (*pp).aa=12;  // what does this mean
    pp->bb =97.2; // what does this mena
    printf("%d%lf\n", mm.aa, mm.bb); 
    getch();      
    }

  2. #2
    Registered User GL.Sam's Avatar
    Join Date
    Aug 2009
    Posts
    88
    You again? You better ask all of your question in the same topic. And it would be much better if you just read a few good books and tuts on C.

    Code:
    (*pp).aa=12;
    * operator dereferences a pointer, so since it points to mm struct it's equivalent to
    Code:
    mm.aa=12;
    -------------------------------------
    Code:
    pp->bb =97.2;
    is exactly similar to
    Code:
    (*pp).bb =97.2;
    P.S. Show at least some appreciation sometime, y'know
    Last edited by GL.Sam; 08-03-2009 at 09:29 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM