+ 1
Can you explain what is wrong with this code?
#include <iostream> using namespace std; int main() { int a=1; int b,c; b=&a; c=*b; cout<<c; return 0; }
3 ответов
+ 3
b should be declared as a pointer too
#include <iostream>
using namespace std;
int main() {
int a=1;
int *b,c;
b=&a;
c=*b;
cout<<c;
return 0
}
this will output 1....
+ 1
I think, U want to copy content of a to c using b as pointer.
See my commented code.
Hope this helps...!!!
#include <iostream>
using namespace std;
int main() {
int a=1;
int b,c;// int a, *b;
b=&a;
c=*b;
cout<<c;
return 0;
}
0
Is there a syntax error or what do you want to know?:)