Hi there. I'm pretty beginner at functions, and I would like to know if it's possible to have a parameter of a function that takes multiple arguments.

Like in Python, you could have

>>> def a(*args):
        print args

	
>>> a(1, 2, 3, 4, 5, 6)
(1, 2, 3, 4, 5, 6)

Where the parameter *args takes all of the numbers I entered, and puts them into a tuple (immutable list). Can one do this in C++ (most likely yes)? If so, may someone teach me how?

Are you looking for a function that takes a variable number of arguments such as printf() ? void foo(int a, ...); Look up varargs.h and associated functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.