Computing.Net > Forums > Programming > Getting address of variable ...

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Getting address of variable ...

Reply to Message Icon

Name: priti
Date: August 8, 2003 at 21:44:22 Pacific
OS: Unix /Cygwin
CPU/Ram: Celeron
Comment:

Hi,
I'm creating reader and writer threads( 10 each). I've declared:
pthread_t *r_thread;
pthread_t *w_thread;

when I try to get value or number of each thread by giving:
cout "\nCreated thread " w_threadwcount] endl;

It gives me output like
Created thread 0xa040ed8

That means I'm getting address instead of the value.
Any help will be greatly appreicated.
Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: August 9, 2003 at 09:31:30 Pacific
Reply:

We need to see the definition of 'pthread_t' to answer this question.

Also, it looks like some characters where stripped from your 'cout' line. Is 'wcount' an index into an array?


0

Response Number 2
Name: borelli34
Date: August 10, 2003 at 12:56:32 Pacific
Reply:

=============================================================
Don,

Unless I am mis-understanding the question...since the declaration of pthread_t has already been assigned to r_thread and w_thread we could just dereference the address identified by *. As long as priti knows the structure of pthread_t they should be able to reference the methods and data belonging to it. Or are you asking to see the declaration of pthread_t so we can see if it's a structure or an object. It's been a while and you are far more versed in this so if I'm overlooking something please post what it is so I'm not confused about it any longer (I can get confused real easily!).

borelli34


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Getting address of variable ...

Address of array pointer. www.computing.net/answers/programming/address-of-array-pointer/975.html

Grand Total of variables in a loop www.computing.net/answers/programming/grand-total-of-variables-in-a-loop/15996.html

MAC address of remote system www.computing.net/answers/programming/mac-address-of-remote-system-/18544.html