What assignment statement sets Price member of struct pointer to PC to 100

This is a discussion on What assignment statement sets Price member of struct pointer to PC to 100 within the C Programming forums, part of the General Programming Boards category; What assignment statement sets Price member of struct pointer to PC to 100? Here is its code: Code: { char ...

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Question What assignment statement sets Price member of struct pointer to PC to 100

    What assignment statement sets Price member of struct pointer to PC to 100?

    Here is its code:
    Code:
    {
    char Manufacturer[30];
    float Price;
    int Memory;
    }*PC;
    I used *PC.Price = 1000.0 but it didn't work, please help?
    cj
    Last edited by correlcj; 08-05-2002 at 05:57 PM.

  2. #2
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    Have you initialized your pointer?

    Try this:
    struct blah
    {
    char Manufacturer[30];
    float Price;
    int Memory;
    }*PC;

    ...

    struct blah p;
    PC = &p;
    PC->Price = 1000.0;

    Voila!

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    One hundred posts later and you still can't get code tags working. And you still ignore your compiler's warning messages too I'll bet.

    [code]
    YOUR CODE HERE
    [/code]

    It is not a difficult concept.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 05-15-2009, 09:38 AM
  2. Assignment HELP!!
    By cprogrammer22 in forum C Programming
    Replies: 35
    Last Post: 01-24-2009, 02:24 PM
  3. Assigning memory address of member struct to pointer.
    By Tronic in forum C++ Programming
    Replies: 2
    Last Post: 03-20-2004, 05:53 PM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 12:14 PM

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