Seeking to clarify something.
It is my understanding that with regard to arithmetical, logical bitwise shifts:
- << work the same for both
- >> shifts differ in which logical shift will always pad byte with 0, whereas arithmetical shift will pad it with the sign bit.
How can i differentiate this using C?
From what i understand, actual operators are the same <<,>>
How would command differ between:
int i=1;
printf ("%d\n", i >> 1); // logical shift
int j=1;
printf ("%d\n", j >> 1); // arithmetical shift
Please let me know,