COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button
C++ LANGUAGE SUPPORT.CPP
Second File: support.cpp
#include <iostream>
extern int count;
void write_extern(void)
{
std::cout << "Count is " << count << std::endl;
}
Here, extern keyword is being used to declare count
in another file. Now compile these two files as follows:
$g++ main.cpp support.cpp -o write
This will produce write executable program, try to execute
write and check the result as follows:
$./write
5
No comments:
Post a Comment