How can I make a variable global from another source file

Hello, how can I make a variable global like for example i have a variable int num =1, it is in numbers.cpp , but I want to transfer it or make it global to main.cpp .. Is this possible,if it is, can someone somehow give an example or help me do it? Thanks in advance.

In main.cpp, add (in a global scope, somewhere near the top of the file):

extern int num;
Topic archived. No new replies allowed.