44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
#include <iostream>
|
|
#include "functions.h"
|
|
|
|
using namespace std;
|
|
|
|
void functionB() {
|
|
}
|
|
|
|
void functionC(); // forward declaration
|
|
void functionD(); // forward declaration
|
|
|
|
int main() {
|
|
const char *lang = "C++";
|
|
std::cout << "Hello and welcome to " << lang << "!\n";
|
|
|
|
for (int i = 1; i <= 5; i++) {
|
|
std::cout << "i = " << i << std::endl;
|
|
}
|
|
|
|
// functionA(); // compiler error - function is defined after call
|
|
functionB(); // no error - function is defined before call
|
|
// functionC(); // linker error - function is declared but not defined
|
|
functionD(); // no error - function is declared and defined
|
|
functionE();
|
|
// functionF(); // linker error - function is defined twice
|
|
|
|
// byte b;
|
|
short s;
|
|
int i;
|
|
long l;
|
|
long long ll;
|
|
|
|
cout << "size of short: " << sizeof(s) << endl;
|
|
cout << "size of int: " << sizeof(i) << endl;
|
|
cout << "size of long: " << sizeof(l) << endl;
|
|
cout << "size of long long: " << sizeof(ll) << endl;
|
|
|
|
return 0;
|
|
}
|
|
|
|
void functionA() {
|
|
}
|
|
|
|
void functionD() {} |