Search:
Forum
Beginners
not fixed variables
[try Beta version]
Not logged in
register
log in
user name:
password:
remember me
forgot your password?
or sign in using:
try again
cancel
forgot your password?
not fixed variables
Jan 24, 2017 at 1:48pm
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
Jan 24, 2017 at 1:57pm UTC
coder777
(8447)
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
Jan 24, 2017 at 3:23pm UTC
Peter87
(11243)
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.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs