C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-12-2009, 11:13 AM   #1
Registered User
 
Join Date: Oct 2009
Posts: 15
Passing by reference in threads

Hiya everyone, i have been looking on google how to pass by reference an struct or any thing else, doesnt matter...I came finding that there is not so much information.

Can you give an hint?

Thanks
tmcp is offline   Reply With Quote
Old 11-12-2009, 11:40 AM   #2
new destructor
 
MK27's Avatar
 
Join Date: Jul 2008
Location: SE Queens
Posts: 5,036
Quote:
Originally Posted by tmcp View Post
Hiya everyone, i have been looking on google how to pass by reference an struct or any thing else, doesnt matter...I came finding that there is not so much information.

Can you give an hint?

Thanks
This is kind of a nomenclature issue. In C, everything is said to be passed by value -- ie, you cannot pass "by reference".

However, you can pass a memory address, which is a value, using a pointer. In fact, this is how "pass by reference" is implemented in higher level languages -- they are C pointers.

So the information you are looking for involves "how to pass a pointer to a struct" not "how to pass a struct by reference".
__________________

“The essential element in the black art of obscurantism is not that it wants to darken individual understanding, but that it wants to blacken our picture of the world, and darken our idea of existence.” [Friedrich Wilhelm Nietzsche, 1878]
MK27 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
In over my head Shelnutt2 C Programming 1 07-08-2008 06:54 PM
Passing by reference not always the best franziss C++ Programming 3 10-26-2005 07:08 PM
Textbox maxorator Windows Programming 20 09-25-2005 10:04 AM
Problem with OpenGL tutorial 2Biaz Windows Programming 18 09-16-2004 11:02 AM
qt help Unregistered Linux Programming 1 04-20-2002 09:51 AM


All times are GMT -6. The time now is 09:54 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22