Posts

int x; int y; int *ptr; is not initialization, right?

Image
up vote 18 down vote favorite 1 I'm reading 'C++ All-in-One for Dummies' by J. P. Mueller and J. Cogswell and stumbled onto this: #include <iostream> using namespace std; int main() { int ExpensiveComputer; int CheapComputer; int *ptrToComp; ... This code starts out by initializing all the goodies involved — two integers and a pointer to an integer. Just to confirm, this is a mistake and should read '... by declaring', right? It's just strange to me that such basic mistakes still make their way to books. c++ initialization language-lawyer declaration terminology share | improve this question edited 2 days ago ...