Question: ```
#include <stdio.h>

void func(int a);

int main() {
    char ch = 256;
    func(ch);
    return 0;
}

void func(int a) {
    printf("%d\n", a);
}

```

The output of the above program is `0`.
Can anyone explain how

Answer: 
`256` is too large for the `char` type on your machine.

So it wraps around to the minimum value `0`, as per the C standard (from N1570, emphasis mine):

> 
> ### 6.3.1.3 Signed and unsigned integers
> 
> 
> 1 When a value with integer type is converted to another integer type other than `_Bool`, if the value
>  can be represented by the new type, it is unchanged.
> 
> 
> 2 Otherwise, if
>  the new type is unsigned, **the value is converted by repeatedly adding
>  or subtracting one more than the maximum value that can be represented
>  in the new type until the value is in the range of the new type.**60)
> 
> 
> 3
>  Otherwise, the new type is signed and the value cannot be represented
>  in it; either **the result is implementation-defined** or an
>  implementation-defined signal is raised.
> 
> 
> 

The `256` literal is an `int`, and `char` is an integer type that is either signed or unsigned, so one of the above emphasized behaviors will occur.
The maximum range of `char` is `127`. The value `256` is `129` more than `127` and when we add `1` to `127` (which is maximum value of char) it goes to minimum value `-128`. So if we add `129` to `127` it results in `0`.

for char 
127 + 1 = -128.
127 + 129 = 0

So for the below program the output is 1.

```
#include <stdio.h>

void func(int a);

int main() {
    char ch = 257;
    func(ch);
    return 0;
}

void func(int a) {
    printf("%d\n", a);
}

```