Solved

(CREATESTRUCT& cs)

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 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.

691 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