3 has type int For your function execution you need short s = 3; fun(s); or fun((short)3);