488 views

1 Answer

Best answer
1 votes
1 votes

$*$ is used for de-referencing and the operator $\&$ is used to get the address.

These operators cancel effect of each other when used one after another. We can apply them alternatively, any number of times.

For example,

$*$ptr gives us $``g"$ (It points to the first address).
$\&*$ptr gives the address of $g$ since $\&$ gives address.
$*\&*$ptr again gives us $``g"$.
$\&*\&*$ptr gives the address of $g$, and finally,
$*\&*\&*$ptr gives $``g"$

Related questions

2 votes
2 votes
1 answer
1
0 votes
0 votes
1 answer
2
Nishi Agarwal asked Mar 10, 2019
614 views
void f(int x,int &y,const int &z){x+=z; y+=z;}int main(){ int a=22,b=33,c=44; f(a,b,c); f(2*a-3,b,c); printf("a=%d b=%d c=%d",a,b,c); return 0;}
0 votes
0 votes
0 answers
3
aimhigh asked Jan 8, 2019
1,260 views
#include<stdio.h>void main(){int p=-8;int i= (p++,++p);printf("%d\n",i);}
0 votes
0 votes
1 answer
4
Rohit Gupta 8 asked Nov 8, 2017
7,115 views
Let A be a square matrix of size n x n. Consider the following program. What is the expected output?C = 100 for(i=0; i<n; i++) for (j=0; j<n; j++) { Temp = A[i][j] + C A[...