-
May 12th, 2012, 12:02 PM
#1
Reference to a pointer
I am unable to get "reference to a pointer".
Here:
char*p = "hello";
char*&k = p;
while creating reference to a pointer why we have to write *&k , why not &*k?
TANUSHREE-AGRAWAL...
-
May 12th, 2012, 12:55 PM
#2
Re: Reference to a pointer
Originally Posted by Tanushreeagr
I am unable to get "reference to a pointer".
Here:
Code:
char*p = "hello";
char*&k = p;
while creating reference to a pointer why we have to write *&k , why not &*k?
I recommend you:
- Change your code writing style to use spaces like
Code:
char* p = "hello";
char*& k = p;
- Use Code tags while posting code snippets.
Now about your question:
Code:
char a; // character a
char* p; // p is a pointer to a character
char& r; // r is a reference to a character
char*& rp; // r is a reference to a pointer to a character
char&* pr; // r would be a pointer to a reference to a character
Victor Nijegorodov
-
May 12th, 2012, 12:56 PM
#3
Re: Reference to a pointer
Originally Posted by Tanushreeagr
I am unable to get "reference to a pointer".
Here:
char*p = "hello";
char*&k = p;
while creating reference to a pointer why we have to write *&k , why not &*k?
That's the syntax for a reference.
An int reference would be
int&, so a char* reference is char*&.
-
May 13th, 2012, 11:42 PM
#4
Re: Reference to a pointer
TANUSHREE-AGRAWAL...
-
October 15th, 2012, 06:14 AM
#5
Re: Reference to a pointer
How to create a new thread , PLEASE HELP ME!!!
TANUSHREE-AGRAWAL...
-
October 15th, 2012, 06:20 AM
#6
Re: Reference to a pointer
#include <stdio.h>
void main()
{
int x = 10 ;
3 = x;
}
When we run the above program compiler error :"left operand must be l-value" occur , why it's telling about left operand while in the
program 3 is on RHS... ????
TANUSHREE-AGRAWAL...
-
October 15th, 2012, 06:24 AM
#7
Re: Reference to a pointer
Originally Posted by Tanushreeagr
How to create a new thread , PLEASE HELP ME!!!
1. Return to the list of threads in C++ (Non Visual C++ Issues) forum.
2. Access the Post New Thread page through the button-like link.
Originally Posted by Tanushreeagr
When we run the above program compiler error :"left operand must be l-value" occur , why it's telling about left operand while in the
program 3 is on RHS... ????
You are mistaken: 3 is on the left hand side.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|