Question: I'm doing some research about variadic functions and arguments.

I noticed that va\_arg is able to cast objects into other objects. For example, when the next argument is a `char`, but you are using `va_arg` like it should be an `int`, it casts the `char` to an `int`:

Function call:

```
AddNumbers(3, 5, 'a', 20);

```

Function declaration:

```
int AddNumbers(int count, ...) {
    int result;

    va_list va;
    va_start(va, count);
    for(int i = 0; i < count; ++i) {
        result += va_arg(va, int);
    }
    return result;
}

```

So my question is: what kind of casting does this function use (C-style, dynamic\_cast, etc.)?

Answer: 
It is not exactly casting, because `va_arg` is a macro, not a function. So the type of `va_arg(va, int)` is *by construction* `int`.

But *promotions* do occur when calling the variadic function (except for the argument preceding the ellipsis.

So in `AddNumbers(3, 5, 'a', 20);`, the character `'a`' is promoted to an int. You can then either use it as an int as your code does, or convert it back to a char (a conversion not a cast) which is defined because the int value can be represented as a char (by construction)
If I understand your question correctly:

C performs certain "casts" by default when calling a variadic function. GCC calls these [default argument promotions](https://www.gnu.org/software/libc/manual/html_node/Calling-Variadics.html). They are:

* Signed or unsigned `char` and `short int` become signed or unsigned `int`.
* `float` becomes `double`.

This isn't really a matter of `va_arg` doing a cast *within* `AddNumbers`; instead, *when calling* `AddNumbers`, the caller promotes the arguments to `AddNumbers` as part of pushing them onto the stack for `AddNumbers` to use.