Linked Questions
111 questions linked to/from What does 'dereferencing' a pointer mean in C/C++?
2
votes
5
answers
2k
views
why a pointer in C can print his content without dereference? [duplicate]
I created a program in which I noticed two things
I used the address of pointer to print the whole word and It works but when I replaced s with
*s it did not work (why is this happened?) (I used ...
1
vote
4
answers
2k
views
When to use dereference operator for pointers C++ [duplicate]
I'm currently studying C++. Not in school. Using books, tutorials and practice.
One thing that confuses me and I haven't been able to track down an answer is when to use the dereference operator (*) ...
0
votes
1
answer
6k
views
how to convert a long int to an int in C [duplicate]
Mostly just the title, I want to know how I can put the random value which is a long int into an int variable address.
void SpinReel(int *a, int *b)
{
long int reela = random() % 40;
a= (int)...
0
votes
0
answers
474
views
Invalid operands to binary expression C++ [duplicate]
I'm working on the C++ project where I have to overload operands in a generic class (template class).
So, I have a sample class like this:
template <class T>
class SomeClass {
private:
T ...
-3
votes
1
answer
113
views
What is pointer Derefrencing in C? [duplicate]
I was learning about recursion using c and there was a question with an array say for example:
void main(){
char str[100];
--snip--
if(*str == 'c')
count++;
--snip--
}
...
0
votes
4
answers
107
views
C++: Why do i not need to dereference for initialising dynamic arrays? [duplicate]
Given the code below:
double** vr(new double*[nx]);
vr[i]=new double[ny];
for(int i=0;i<nx;++i) { //Loop 200times
for(int j=0;j<ny;++j) { //Loop 200times
vr[i][j]=double(i*i*i*j*...
1
vote
1
answer
236
views
Does converting a pointer to int actually return the location of it in byte or something? [duplicate]
I am new to C++, but I am curious enough to dig into these strange things.
I was wondering what happens when I convert a pointer to an int and realized could they indicate something. So I wrote this ...
0
votes
1
answer
144
views
Memory exploitation for setting member variables of a Structure in one step [duplicate]
The below algorithm can output 99 0000
Would you please let me know how does this following line of code work?
*(long*)&(st->flag1) = 0;
The algorithm is:
#include <stdio.h>
struct ...
-9
votes
2
answers
145
views
The displayed value is: C++ [duplicate]
I got this piece of code and I have to choose the correct answer.
int x = 5;
int* y = &x;
cout << *y << endl;
And now:
a)y value raised to a power
b)address of the cell in which x is ...
-3
votes
2
answers
119
views
c language printing out value in pointer? [duplicate]
I am trying to print out values in integer pointer. This pointer stores binary search tree keys inorder way.
So my inorder function is,
int traversal(int* num,node *t, int i) {
if (t == NULL) {
...
731
votes
19
answers
949k
views
What's the difference between passing by reference vs. passing by value?
What does it mean to say that a parameter is passed "by reference" or "by value"? How do such parameters differ?
90
votes
12
answers
11k
views
Take the address of a one-past-the-end array element via subscript: legal by the C++ Standard or not?
I have seen it asserted several times now that the following code is not allowed by the C++ Standard:
int array[5];
int *array_begin = &array[0];
int *array_end = &array[5];
Is &array[5] ...
87
votes
8
answers
168k
views
Meaning of "referencing" and "dereferencing" in C
I read different things on the Internet and got confused, because every website says different things.
I read about * referencing operator and & dereferencing operator; or that referencing means ...
83
votes
5
answers
43k
views
How does dereferencing of a function pointer happen?
Why and how does dereferencing a function pointer just "do nothing"?
This is what I am talking about:
#include<stdio.h>
void hello() { printf("hello"); }
int main(void) {
(*****hello)();...
52
votes
2
answers
41k
views
What do square brackets mean in x86 assembly?
I'm very new to assembly, and have some very basic questions.
What is the difference between these four commands?
mov ebx, eax
mov [ebx], eax
mov ebx, [eax]
mov [ebx], [eax]
They say that the ...