+ 1

How can i use variables from a header file C++

i've a header where i difined a variable for example an int n ; and i want to use this variable in source code for exemple in my header file n take a value 3 i want to conserve this value when including header file . file.h Int n=3; file.cpp int main(){ Cout<<n; return 0;} How to make that print 3 do you understand me 😅😅

27th May 2021, 4:56 PM
Mohamed Chouai
Mohamed Chouai - avatar
6 Antworten
+ 1
Thank you Martin Taylor
28th May 2021, 1:13 PM
Mohamed Chouai
Mohamed Chouai - avatar
0
it works with simple data but arrays the problem still present
27th May 2021, 7:06 PM
Mohamed Chouai
Mohamed Chouai - avatar