+ 2
How to write a code in c++ that differentiates between using asterisk(*) for pointer declaration and the deference operator?
2 Answers
+ 1
Do you mean something like:
int main()
{
int x = 5, *a = &x;
// * - Declares Pointer to type 'int'
cout<<*a<<endl;
// * - Dereference Operator
}
+ 1
yes.thanks