Answers for "variadic functions"

0

variadic functions

func add(args ...int) int {
  total := 0
  for _, v := range args {
    total += v
  }
  return total
}
func main() {
  fmt.Println(add(1,2,3))
}
Posted by: Guest on July-18-2021
0

variadic functions

Variadic functions are functions which take a variable number of arguments.
In C programming, a variadic function will contribute to the flexibility of
the program that you are developing.

int printf(const char* format, ...);
Posted by: Guest on March-17-2021

Browse Popular Code Answers by Language