• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 115
  • Last Modified:

(CREATESTRUCT& cs)

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
rickhill11
Asked:
rickhill11
1 Solution
 
jkrCommented:
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
 
Subrat (C++ windows/Linux)Software EngineerCommented:
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
 
rickhill11Author Commented:
Got it!  Thanks to both of you.  I really appreciate your taking the time.

Rick
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now