So I have seen a program from elsewhere and the declaration is outside from the main function. Just like this code:
#include<iostream>
using namespace std;
int num1, num2;
int *ptr1 = &num1, *ptr2 = &num2;
char operation, answer;
char *ptrop = &operation;
int main(){
}
But what I am using right now is inside the main function like this:
#include<iostream>
using namespace std;
int main(){
int num1, num2;
int *ptr1 = &num1, *ptr2 = &num2;
char operation, answer;
char *ptrop = &operation;
So what is the difference from it?