+9  A: 

in C (and other languages probably) a single | or & is a bitwise comparison.
The double || or && is a logical comparison.
Edit: Be sure to read Mehrdad's comment below regarding "without short-circuiting"

In practice, since true is often equivalent to 1 and false is often equivalent to 0, the bitwise comparisons can sometimes be valid and return exactly the same result.

There was once a mission critical software component I ran a static code analyzer on and it pointed out that a bitwise comparison was being used where a logical comparison should have been. Since it was written in C and due to the arrangement of logical comparisons, the software worked just fine with either. Example:

if ( (altitide > 10000) & (knots > 100) )
...
dustmachine
Mehrdad Afshari
Wow, really? That's interesting and I'll have to learn more about C#. I will update the answer to point to your comment.
dustmachine
Mehrdad's comment is actually not unique to C# -- many (most?) strongly typed languages have this distinction. I know it's present in Java and C++, and I assume it's present in C, for example.
Richard Dunlap
STW
I meant to say "...will throw a NullReferenceException if o is null..."
STW
dustmachine
Grant Wagner
@dustmachine: Actually, it does have special meaning because the operator has different behavior depending on whether the operands are integral types or **bool**: http://msdn.microsoft.com/en-us/library/sbf85k1c.aspx : Binary that is, the result is **true** if and only if both its operands are **true**.
Grant Wagner
+3  A: 

& and | are binary operators while || and && are boolean.

The big difference:
(1 & 2) is 0, false
(1 && 2) is true

David
Chris Zwiryk
The original question didn't mention C#. It was edited after.
David
+1  A: 

The instance in which you're using a single character (i.e. | or &) is a bitwise comparison of the results. As long as your language evaluates these expressions to a binary value they should return the same results. As a best practice, however, you should use the logical operator as that's what you mean (I think).

Zac
+1  A: 

(Assuming C, C++, Java, JavaScript)

| and & are bitwise operators while || and && are logical operators. Usually you'd want to use || and && for if statements and loops and such (i.e. for your examples above). The bitwise operators are for setting and checking bits within bitmasks.

Graeme Perrow
+5  A: 

& and | are bitwise operators that can operate on both integer and Boolean arguments, and && and || are logical operators that can operate only on Boolean arguments. In many languages, if both arguments are Boolean, the key difference is that the logical operators will perform short circuit evaluation and not evaluate the second argument if the first argument is enough to determine the answer (e.g. in the case of &&, if the first argument is false, the second argument is irrelevant).

Richard Dunlap
upvote for being first to mention the short circuiting of boolean operators
David
A: 

The & and | are usually bitwise operations.

Where as && and || are usually logical operations.

For comparison purposes, it's perfectly fine provided that everything returns either a 1 or a 0. Otherwise, it can return false positives. You should avoid this though to prevent hard to read bugs.

Daniel