Im looking for the correct syntax to typecast a character array as an int.
So i would be able to do something like this:
1 2 3
char ch[4];
//...Read characters from file into ch or something, etc...
int i = ( int ) &ch;
or
1 2 3 4
char ch[4];
//...Read characters from file into ch or something, etc...
int i;
strncpy ( ( char* ) &i, ch, 4 )
I want all the 4 characters ( or bytes ) of ch to be classed as an int. So we are taking the 4 bytes of the character array and placing them in 4 bytes of the integer? How would i go about this?