+ 1

Ask Coding C++

#include <iostream> using namespace std; int main(){ void main(){ int x; int y; int *p=&x; int *q=&y; *p =46; *q=39; x=x+y; cout << *p <<" " *q << endl; } }

3rd Feb 2019, 11:18 AM
Achmad Imannudin
Achmad Imannudin - avatar
4 Answers
+ 5
So, what is the question? ... Why do you have a main function with no return type, declared inside a main function which returns int? Do you need help to correct your code? Do you need help explaining the output of the code (given that the errors are corrected) ?
3rd Feb 2019, 11:50 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
You entered " " followed by *q, but it you had to enter " " << *q at the cout line.
3rd Feb 2019, 10:44 PM
3xi0
3xi0 - avatar
0
Sorry, I have error code
3rd Feb 2019, 12:09 PM
Achmad Imannudin
Achmad Imannudin - avatar
0
Yes, help to correct code
3rd Feb 2019, 12:09 PM
Achmad Imannudin
Achmad Imannudin - avatar