Convert Sint16 to int ?

Feb 14, 2012 at 8:56am
I'd like to convert sint16 (short int 16-bits) to int.

Or otherwise, I'd like to compare sint16 with int

Cuz no functions support these operands
Feb 14, 2012 at 9:49am
You can just cast it:

1
2
short a = 10;
int b = (int)a;


If it is for a function:
1
2
3
4
5
6
7
8
void Function(int a);

int main()
{
    short x = 10;
    Function((int)x);
    return 0;
}
Last edited on Feb 14, 2012 at 9:53am
Topic archived. No new replies allowed.