// // example of const declarations // Emiliano.Mocchiutti@ts.infn.it // #include using namespace std; int main(){ int const nStudents = 10; // nStudents = 5; // not allowed, does not compile!! cout << " nStudents " << nStudents << "\n"; int const *i = new int(8); cout << " i " << *i << "\n"; // *i = 10; // not allowed, does not compile!! i++; cout << " i " << *i << "\n"; int *const j = new int(3); cout << " j " << *j << "\n"; *j = 10; // ok! cout << " j " << *j << "\n"; // j++; // not allowed, does not compile!! int const *const k = new int(64); cout << " k " << *k << "\n"; //*k = 10; // not allowed, does not compile!! //k++; // not allowed, does not compile!! return 0; }