// Code derived from Stroustrup's PPP2 book// § 8.2 Declarations and definitions// -and beginning on p 258#include<iostream>#include<vector>usingnamespacestd;intf(int);// declaration of fintmain(){inti=7;// declaration of icout<<f(i)<<'\n';}intf(intn){returnn;}// definition of f//---inta=7;// definitionvector<double>v;// declaration//---doublesqrt(double);// declaration, no function body heredoublesqrt(doubled){returnd;}// definition, has function bodydoublesqrt(double);// another declaration of sqrtdoublesqrt(double);// yet another declaration of sqrt// int sqrt(double); // error: inconsistent declarations of sqrt//---// int a; // error: double definition of aexterninta;// “extern plus no initializer” means “not definition”externintx;// declarationexternintx;// another declaration//intx=7;// definition//---doubleexpression();// just a declaration; not a definitiondoubleprimary()// definition{// ...returnexpression();}doubleterm()// definition{// ...returnprimary();}doubleexpression()// definition{// ...returnterm();}