C++ initialize variable based on condition
Clash Royale CLAN TAG #URR8PPP C++ initialize variable based on condition I am currently trying to figure out how to initialize variables based on conditions. So this is the current code that I want to modify: int dimsOut[4]; dimsOut[0] = data->nDataVar(); dimsOut[1] = dims[0]; dimsOut[2] = dims[1]; dimsOut[3] = dims[2]; const size_t dataSize = data->primType().getTypeSize() * dimsOut[0] * dimsOut[1] * dimsOut[2] * dimsOut[3]; Since this is part of a giant project (mostly C++98 with some parts of C++03) I want to try to modify as less as possible to avoid any problems in the rest of the code. So what I want to do is simply in case data->nDataVar() returns 1 that the code above executes and in case it returns something else it should basically do this data->nDataVar() int dimsOut[3]; dimsOut[0] = data->nDataVar(); dimsOut[1] = dims[0]; dimsOut[2] = dims[1]; const size_t dataSize = data->primType().getTypeSize() * dimsOut[0] * dimsOut[1] * dimsOut[2]; I am aware that i...