felixhao28 / JSCPP

A simple C++ interpreter written in JavaScript

Home Page:https://felixhao28.github.io/JSCPP/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scope

billcollis opened this issue · comments

I tried the following and it works, but m should not be in scope

#include
using namespace std;

int g=1;

int main() {
int m = 2;
cout << "scope test" << endl;
func1();
return 0;
}

void func1(){
int f1 = 10;
cout << g << endl;
cout << f1 << endl;
cout << m << endl; //should not be in scope but is?
}