Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ Default Parameters

void myFunction(string country = "Norway") {
  cout << country << "
";
}

int main() {
  myFunction("Sweden");
  myFunction("India");
  myFunction();
  myFunction("USA");
  return 0;
}

// Sweden
// India
// Norway
// USA
 
PREVIOUS NEXT
Tagged: #Default #Parameters
ADD COMMENT
Topic
Name
9+6 =