is it possible to make sprintf hold more than 1 string , like use it like an array.
or is there any other way to create an array which can hold both integers and chars and not change their values ??
This is a discussion on sprintf within the C Programming forums, part of the General Programming Boards category; is it possible to make sprintf hold more than 1 string , like use it like an array. or is ...
is it possible to make sprintf hold more than 1 string , like use it like an array.
or is there any other way to create an array which can hold both integers and chars and not change their values ??
What does that even mean?
sprintf is a function that returns a string. What you do with that string is up to you.
Arrays by definition must have every element of the same type.
But remember that a char array can hold strings, integer and floating point numbers (all as strings, of course). It is the closest thing you can get to a generic array.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Potentially you could use an array of an union and then just put the potential types in the union definition.
Although it may not be exactly what you want.