Solved

(CREATESTRUCT& cs)

Posted on 2014-12-31
3
103 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Mobile 6.5 device Apache Flex 3 44
Convert GUI app into console app for Win32 Env 5 78
Using MS Code on my Mac 6 64
How do ASP.NET and MVC work together? 4 27
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

911 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

16 Experts available now in Live!

Get 1:1 Help Now