Questions tagged [addressof]

95 questions
0
votes
1 answer

When I add up in my pointer address it points to my array? Why? Reference and Dereference confusion C++

In this example, I have an array of four elements. I have declared a pointer to integer which contains the address of array. Then i have displayed the address of 0th index in 3 different ways. Similarly, the address of 1st index is displayed in 3…
0
votes
5 answers

How does these Pointer statements differ *p = &i , h = &j?

I've been trying to work with pointers and i've encountered this problem. In this code .. p,h are two pointers ... i've equated *p = &i , h = &j ; and printed the values my expectation was that *p will contain the address and p will have the address…
Akash Gutha
  • 601
  • 8
  • 21
0
votes
4 answers

Pointers: a query about pointers

I'm learning C and C#. I'm learning about pointers and don't know what it means to combine the indirection operator and the address operator. What does it mean to combine the two? Here is an example: int *p, *q; p = *&q;
somethingSomething
  • 830
  • 7
  • 20
  • 43
0
votes
2 answers

cpp newbie- how to convert values from string to ref (address of) variables

In C++ This is the function I am coding now- insertobjectnames(std::string clsname, std::string objname) Now within the above function I have to invoke another function that takes as input the same parameters as above 2, but as address of…
0
votes
1 answer

Converting AddressOf from VB6 to c#

In VB6 we have the below code. g_CTimer.TimerID = SetTimer(0&, 0&, g_CTimer.Interval, AddressOf TimerProc) The TimerProc method is as below Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) On…
Achyuth
  • 41
  • 7
0
votes
2 answers

Visual basic 2008 issue with adding a method to my dynamic objects

I have searched for an answer to my question since last thursday. A lot of answers about my exact same question have been answerd in vb.net. However, I am working on Visual Basic 2008 and those two language seems to have differences that are for me…
0
votes
1 answer

Threading sub sending value

Hey all i have this being called: Public Sub doStuff(ByVal what2Do As String) Dim command As String = "" If Trim(lanSent(1)) = "turnOffPC" Then command = "r5" ElseIf Trim(lanSent(1)) = "TurnOnPC" Then command = "r3" End…
StealthRT
  • 10,108
  • 40
  • 183
  • 342
0
votes
3 answers

Understanding complex pointer and address-of operators using *&*&p in C

Can any one explain how the printf is printing hello in the following? #include void main() { char *p; p="hello"; printf("%s",*&*&p); } I know that *&p...means value in p, i.e the address of string "hello". What is happening in the…
Rohit
  • 635
  • 6
  • 12
  • 22
0
votes
2 answers

vb.net threading.thread addressof passing variables

I am trying to pass some status from a IP call in a shared sub to a label on my form. This is the current code that i am using: Class Server Public Shared Sub Main() Dim aTcpMessaging As IMessagingSystemFactory = New…
StealthRT
  • 10,108
  • 40
  • 183
  • 342
-1
votes
2 answers

In which case I need ampersand in pointers?

I am trying to understand pointer to pointers and I can not understand why in first case I need (&) ampersand ( I receive a message [Error] cannot convert 'char*' to 'char**' in assignment ) and in the second case I don't need ampersand first case…
vgag1997
  • 31
  • 1
-1
votes
6 answers

what is the difference &p and *p_p in C?

I just studying pointers in C and I wondered what is the address of a pointer and after I searched on the Internet I wrote this piece of code. #include int main() { int n = 60; int *p = &n; int **p_p = &p; printf("%p\n",…
Ulaş Sezgin
  • 308
  • 2
  • 10
-1
votes
2 answers

Why does someNumber = rand() & 100 + 1; not produce an error?

I was attempting to generate a random number between (1 - 100), and the code to ran, but not doing what I wanted. I noticed I accidentally type &, instead of % with the rand() function, and the compiler did NOT give me an error. What exactly is…
-1
votes
3 answers

Does address-of operator return address of an object referenced by the variable

This is different question from this one, as here I'm using object type struct, instead of a value 23.... I'm reading this chapter on pointers and it states the following: The address of a variable can be obtained by preceding the name of a …
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
-1
votes
1 answer

Adding Handler using 'AddressOf'

When trying to add an event handler to a dynamically created button I get an an error: Dim Itm As New Button Itm.Name = "Itm" & i Itm.Height = 62 Itm.Width = 159 Itm.Text = Temp(i, 0).ToUpper Itm.Left = (F * 165) Itm.Visible = True Itm.BackColor =…
James.Net
  • 11
  • 1
-1
votes
1 answer

Using & operator with char data type

Possible Duplicate: Why is address of char data not displayed? I was experimenting with ampersand operator and got stuck at this program : #include using namespace std; int main() { char i='a'; cout<<&i; return 1; } I was…
Maverick Snyder
  • 31
  • 1
  • 1
  • 6