cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
not fixed variables
not fixed variables
Jan 24, 2017 at 1:48pm UTC
baraanashed
(2)
please help me with this i need some help
Suppose we have the function that is used to print variables to your computer screen. Type of variables are unknown and the number of variables is not fixed, it can be two or three. Write a c program using function template to solve this problem.
Jan 24, 2017 at 1:57pm UTC
coder777
(8444)
See variadic templates:
http://www.cplusplus.com/articles/EhvU7k9E/
http://en.cppreference.com/w/cpp/language/parameter_pack
Especially the example with recursive call.
Jan 24, 2017 at 3:23pm UTC
Peter87
(11234)
Write a c program using function template to solve this problem.
C doesn't have function templates.
Either you write it in C++ using variadic templates as coder777 suggested.
Or you write it in C using va_list, va_args, etc. from the stdarg.h header.
http://en.cppreference.com/w/c/variadic
Topic archived. No new replies allowed.