Yes, you can write any of those three method because compiler is smart enough to know b is a pointer and 'a' is just a veriable. But all must have initialized before.
Also *b*a will return same result.
Try the following walkthrough...
#include using namespace std;
int main() { int *a; int b = 4; int c = 5; a = &b;
Yes, you can write any of those three method because compiler is smart enough to know b is a pointer and 'a' is just a veriable. But all must have initialized before.
ReplyDeleteAlso *b*a will return same result.
Try the following walkthrough...
#include
using namespace std;
int main() {
int *a;
int b = 4;
int c = 5;
a = &b;
cout<<*a*c<<endl; //20
cout<<c*(*a)<<endl; //20
cout<<c**a<<endl; //20
return 0;
}