Questions tagged [dereference]

Anything related to pointer dereference, i.e. the process of determining the object which the pointer is referring to. Languages having pointer variables usually have a special operator to perform dereferencing of pointers (e.g. in C and C++, if `p` is a valid pointer, `*p` is the object pointed to by `p`).

Anything related to pointer dereference, i.e. the process of determining the object which the pointer is referring to. Languages having pointer variables usually have a special operator to perform dereferencing of pointers (e.g. in C and C++, if p is a valid pointer, *p is the object pointed to by p).

1184 questions
-4
votes
2 answers

C error - dereferencing pointer to incomplete type

I am trying to get information from Tree field I made, and I am getting the error in the title: dereferencing pointer to incomplete type 'struct List_t' Tree Source File: struct Node_t{ Element data; char* location; struct Node_t* son; struct…
MaorE
  • 1
  • 3
-4
votes
1 answer

"int cannot be dereferenced" error is at k=PIE.gcd(e1)

import java.io.*; import javax.servlet.*; import javax.servlet.ServletException; import javax.servlet.http.*; import java.sql.*; import java.math.*; public class Servlet3 extends HttpServlet { protected void doGet(HttpServletRequest…
-4
votes
2 answers

Dereferencing multi-level pointers

This may be a duplicate of some other question/answer (which I couldn't find), but it seems to me that there are good explanations of why and when to use multi-pointers, but a simple explanation of how a pointer to a pointer is dereferenced is…
TomBombadil
  • 83
  • 1
  • 7
-4
votes
2 answers

Shows an error if the pointer variable being displayed is changed

I am a high school student currently learning C++.So while doing pointers I came across a problem, When I try to display the value at y,it shows: The value of x is displayed properly,but after I write *y as *(x+1),it works fine Can any one please…
arkin
  • 111
  • 4
-4
votes
2 answers

What is the difference between * and & in function parameters?

I have seen something in this form: void function( A_struct &var ) { var.field0 = 0; // ... } Since there is & before var, I thought that var is a pointer. But in the body, instead of writing var->field0, var.field0 is written. So, my…
Utku
  • 2,025
  • 22
  • 42
-4
votes
2 answers

The more complex notation of the Structure Dereference operator in C, ->?

I have an exam question question here which asks: "The C operator -> is a shorthand for a more complex notation. Explain the circumstances in which -> or the more complex notation would be used. Write an example of the more complex notation." I`m…
ajq88
  • 305
  • 1
  • 14
-4
votes
2 answers

Unhandled exception at 0x009f240e in OpenGL and GLUT - 101.exe: 0xC0000005: Access violation writing location 0x00000000

I keep getting the following error: Unhandled exception at 0x009f240e in OpenGL and GLUT - 101.exe: 0xC0000005: Access violation writing location 0x00000000. I have found some questions here with a similar error code but they all seem to say the…
user1824239
  • 167
  • 1
  • 1
  • 5
-5
votes
2 answers

Why Do I get the memory adress instead of the real value ? Pointer c++

int x = 2; int y=8; int* p = &x; *p=y; cout << p <
Cyreex
  • 1
-5
votes
1 answer

understanding code in c++

This question arose while studying NS-3 codes. There is a for loop as below enter code here for (NetDeviceContainer::Iterator i = periDevice.Begin (); i != periDevice.End (); i++) { …
spectre
  • 113
  • 1
  • 9
-5
votes
1 answer

when is dangeraous using dereference to 0 pointer?

consider following example: // someLibrary.h which is exported. struct HandlePrivate; typedef HandlePrivate& Handle; Handle getHandle(int code); void closeHandle(Handle handle); // someLibrary.cpp #include…
Khurshid
  • 2,654
  • 2
  • 21
  • 29
-5
votes
2 answers

Dereference causes error: expected primary-expression before ')' token

When I use a dereference in a function as an argument, the preprocessor spits out an error. I believe the * right before the parentheses causes ambiguity with the compiler. Is there any way to get around this? #include #include…
Groditz
  • 115
  • 12
-7
votes
1 answer

Modification of dereferenced value leads to modification of true value

I have some code taken as examples to pointer. short value=7; short…
-11
votes
1 answer

What is the purpose of * in C++?

int main() { string s("some string"); if (s.begin() != s.end()) auto it = s.begin(); *it = toupper (*it) ; // Error ; the identifier "it" is undefined } Why is *it undefined? And do why we need to use dereference in the…
larry
  • 1
-22
votes
2 answers

Why we don't require to dereference the pointer to a string while passing to printf?

#include int main() { char *p = NULL; char str[] = "How do you do!!!!!"; p = &str; printf("String is:%s",p); p = "HELLO HOW ARE YOU"; printf("String is:%s",p); printf("Hello"); int a = 10; int *pa; pa = &a; …
1 2 3
78
79