SSJ2Joseph
Programmer
Hey all,
I am VERY new to C and I'm not completely comfortable with the operators. One of the books I've been using to learn C asks that I use the bitwise operators (~ & ^ | + >> <<) and the ! operator to define a conditional function : int conditional(int x, int y, int z). The function wants me to return y if x is true and z if it is false. I can't use any control statements (if, for, etc.) I can declare variables to store values. I am stumped and would appreciate it if someone told me how this is possible. Thanks.
I am VERY new to C and I'm not completely comfortable with the operators. One of the books I've been using to learn C asks that I use the bitwise operators (~ & ^ | + >> <<) and the ! operator to define a conditional function : int conditional(int x, int y, int z). The function wants me to return y if x is true and z if it is false. I can't use any control statements (if, for, etc.) I can declare variables to store values. I am stumped and would appreciate it if someone told me how this is possible. Thanks.