Solved

what is the use of " | " in c language?

Posted on 2011-02-24
3
349 Views
Last Modified: 2012-05-11
char x;
char y;
char z;
z= x | y;
I was wondering what is the use of " | " in c language, does it add bits?

0
Comment
Question by:logicallayer
3 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 125 total points
ID: 34969238
the result is the bitwise inclusive OR function of its operands.
0
 
LVL 33

Assisted Solution

by:sarabande
sarabande earned 125 total points
ID: 34969331
the bitwise or means that any bit set in either operand x or y would be set (1) in z.

contrary logical & is bitwise and and z would have only those bits set which were both set in x and y.

Sara
0
 

Author Closing Comment

by:logicallayer
ID: 34969473
now it make sense, as I was going through a code of friend and this totally explains it...

thanks for both of you.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question