address of struct variable?

This is a discussion on address of struct variable? within the C Programming forums, part of the General Programming Boards category; Hi, I was wondering if anyone could tell me how to pass the address of a specific variable in a ...

  1. #1
    Registered User
    Join Date
    Feb 2008

    Smile address of struct variable?

    Hi, I was wondering if anyone could tell me how to pass the address of a specific variable in a struct?


    typedef struct
      uint8_t     A;
      uint8_t     B;
      ExtAddr_t   C;
    } stuff_t;
    Doing the above I get the warning: “passing argument 1 of 'doSomething‘ from incompatible pointer type”

    Any pointers would be greatly appreciated

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    More like:
    stuff_t stuff;
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Join Date
    Oct 2007
    The first does not compile since you can't take something from a blueprint.
    Anyway, if you'd follow laserlight's advice and make doSomething take a uint8_t* pointer, then it should work fine.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting from C to C++
    By Taka in forum C++ Programming
    Replies: 5
    Last Post: 04-08-2009, 02:16 AM
  2. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM
  3. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 06:17 PM
  4. Replies: 16
    Last Post: 10-29-2006, 04:04 AM
  5. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

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