It says all over that void f() means that it returns no value. But this function below does return a value to the main function which is 1000. Am I correct?
Basically void is taking place of a return type. Maybe it returns a value but no return type(ie. int, char, bool)?
Basically void is taking place of a return type. Maybe it returns a value but no return type(ie. int, char, bool)?
Code:
void SetTo1000(int iaArray[], int iIndex)
{
iaArray[iIndex] = 1000;
}
int main()
{
int iMyArray[5] = {-3,2,0,-1,5};
SetTo1000(iMyArray,3);
for (int iIndex=0; iIndex<5; iIndex++)
{
cout << iMyArray[iIndex] << endl;
}
return 0;
Comment