Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

(CREATESTRUCT& cs)

Posted on 2014-12-31
3
Medium Priority
?
114 Views
Last Modified: 2015-01-01
I am an old K&R guy, so I am well versed on pointers, addresses, pointers to pointers, etc.  However, I've noticed that in some of the AppWizard created code, "&" is used where I would expect to see a "*".

So I am trying to understand the syntax of, for instance, PreCreateWindow(CREATESTRUCT& cs)

I'm not particularly interested in how or what happens in PreCreateWindow, I am interested in the syntax and what it accomplishes.

Thanks in advance, Rick
0
Comment
Question by:rickhill11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 40526185
This is called a 'reference' in C++, and the name pretty much explains what it means - 'reference' as in 'passing by reference'. For more about this and all the implications, see

- http://www.cprogramming.com/tutorial/references.html

- http://en.wikipedia.org/wiki/Reference_(C++)

- http://www.tutorialspoint.com/cplusplus/cpp_references.htm
0
 
LVL 9

Expert Comment

by:Subrat (C++ windows/Linux)
ID: 40526371
Adding something more on JKR's comment.

In C, function call can be made by
1. Pass by value
2. Pass by reference( It's actually pass by address).

In C++ pass by reference is different than pass by address.

Reference is a concept introduced in C++.
C programmers tells "pass by address" as "pass by reference".

Caller calls the function in the way they are "Calling by value".

Here difference in "call  by value" is, another variable/object would be created. but in "call by reference", it'll not create any new variable/object rather it create an "Alias of passed variable". So in calling function, value of passed variable can be changed which is not possible if you are passing it by value.

To know how reference works, please follow the above links pointed by JKR.
0
 

Author Closing Comment

by:rickhill11
ID: 40526404
Got it!  Thanks to both of you.  I really appreciate your taking the time.

Rick
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question