Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void UseParams(params int[] list) {
- for (int i = 0; i < list.Length; i++) {
- Console.Write(list[i] + " ");
- }
- Console.WriteLine();
- }
- UseParams(1, 2, 3, 4); // UseParams(int ..........)
- void updateJsonArray_INA(INA3221DATA _channel1, INA3221DATA _channel2, INA3221DATA _channel3) {
- }
- void updateJsonArray_INA(INA3221DATA _channel1, _channel2, _channel3) {
- }
- #include <stdio.h>
- #include <stdarg.h>
- void use_params(int number_of_params, ...) {
- va_list args;
- va_start(args, number_of_params);
- for(int i = 0; i < number_of_params; ++i) {
- some_type element = va_arg(args, some_type);
- do_something_with(element);
- }
- va_end(args);
- }
- void main() {
- use_params(4, 'a', 'b', 'c', 'd');
- }
- #include <stdio.h>
- #include <stdarg.h>
- void use_params(const std::vector<int>& params) {
- for(size_t i = 0; i < params.size(); ++i) {
- do_something_with(params[i]);
- }
- }
- void main() {
- use_params({1, 2, 3, 5});
- }
Add Comment
Please, Sign In to add comment