im trying to learn what a certain function does and then i stumble upon this part. i do get that << 2 means shift left by 2. what i do not know is the (int)ADHR part. can anyone help me out with this? thank you

ADHR should be, by convention, a defined global variable or constant, (thus the all caps). First that value (defines in C are a straight substitution) is left shifted two places, then the result is cast as an integer.

thank you sir. one more thing to clarify, say ADHR contains a binary word for example 1110001. left shifting this 2 places to the left will give me 1000100 right? what happens when it is "cast as an integer"?

N << 2 Is a logical shift left, 2 bits. There is no arithmetic left shift! Same as a multiplication x4

N >> 2 Is a logical shift right 2 bits if N is unsigned integer. Div 4
N >> 2 is an arithmetic shift right 2 bits if N is a signed integer.

The difference between an arithmetic shift and a logical shift is the MSB (Most Significant Bit) is what I refer to as a sticky bit. The MSB is preserved why shifting to the right. A logical right shift clocks in a zero into the MSB.

I think the type cast has to be done before applying the shift operator. Here is an example to show why

int main()
{
float f= 5.67;
int x= (int)f<<2;
printf("%d\n",x);
return 0;
}

If f is not typecasted before applying the shift operator then the code will not compile as shift operators cannot be applied to floating point numbers.
This code does compile and produces the answer 20

Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.

I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:

try
{
Runtime run = Runtime.getRuntime();
Process pr = ...

Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...