CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: dword

  1. #1
    Join Date
    Dec 2011
    Location
    Bucharest, Romania
    Posts
    29

    dword

    hi,
    there have been few exercises by myself to enter cpp because of limitation of books i stumbled upon

    please answer me a question on the following exercise from msdn

    main(){
    dword dwaveragesize;
    ...
    dwaveragesize=(dword)-1;
    createmmio(hmmio, &dwaveragesize,0);
    ...
    }

    what is value in &dwaveragesize before using it in this multimedia function?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: dword

    The value of &dwaveragesize is the address of dwaveragesize.
    The value of dwaveragesize is according to your code snippet (dword)-1
    Victor Nijegorodov

  3. #3
    Join Date
    Aug 2005
    Location
    San Diego, CA
    Posts
    1,054

    Lightbulb Re: dword

    '&' takes the address of the variable which is whatever the environment assigns. You are passing the address of the variable to the function, which will presumably modify that variable so that it is changed when main continues. The initial value of the variable is unspecified and could be anything. Then you make an assignment of (-1). The value of the address is not something that a programmer needs to worry about. The important thing is that you understand what is happening in the program.

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

Featured