Solved

(CREATESTRUCT& cs)

Posted on 2014-12-31
3
101 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
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 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 8

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now