Mega Code Archive
Categories
/
C++ Tutorial
/
Function
More than one returning value
#include
void f (int x, int& prev, int& next) { prev = x-1; next = x+1; } int main () { int x=100, y, z; f (x, y, z); cout << "Previous=" << y << ", Next=" << z; return 0; } Previous=99, Next=101"