BrainDump
  Home arrow BrainDump arrow Page 2 - C: More Operators and Arrays
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

C: More Operators and Arrays
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-02-19

    Table of Contents:
  • C: More Operators and Arrays
  • Bitwise Operators
  • Arrays
  • Two-Dimensional Arrays
  • Commenting on Your Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    C: More Operators and Arrays - Bitwise Operators


    (Page 2 of 5 )

    Though these operators are a bit beyond the scope of this particular article, it is good to know of their existence; otherwise when I teach them to you in a future article, you will have a heart attack and that insurance policy your mom and I just took out on you will pay us handsomely.


    Operator

    What it Means

    &

    For Bitwise AND

    |

    For Bitwise OR

    ^

    For Bitwise Exclusive

    <<

    For Shift left

    >>

    For Shift right

    These operators manipulate given data at the bit level, operating on each bit of the data. They cannot be used on floats or doubles.

    Well they can, but it won't work. Chump.

    Comma Kazi

    When we want to link a series of related expressions together, we use the comma operator. The list of expressions is evaluated from left to right and the last expression becomes the value of the expressions combined.

    Behold my mighty example:


    hercules = (a=5, b=12, a+b);

    In the above example, we assign a the value of 5, and b the value of 12. Then we add a and b together, and that value becomes the value of hercules. So in the end, hercules becomes 17.

    We will discuss the comma operator more in depth when we cover Loops in a future tutorial.

    Does This Variable Make Me Look Fat?

    The "size of" operator returns the size of a data type, variable, arrays, constants, and data type qualifiers. It tells you how many bytes the operand takes up in memory. You can also use it to allocate memory to variables when the program executes.

    The "size of" operator is a little beyond the scope of this article.

    There are other operators in C, such as the pointer operators and selection operators, which we will cover in upcoming episodes.

    One last thing regarding operators. When we want to give a part of an equation precedence, we do so by encapsulating it with parentheses(). Consider the following:

      5+2*5= 35

      5+(2*5)= 15

    In the first example, math is performed left to right, result in the answer thirty-five. In the second example however, we give the equation 2*5 precedence by wrapping it in parentheses. This way the program does the multiplication first, then adds 5, resulting in the answer 15.

    More BrainDump Articles
    More By James Payne


       · Thanks for dropping by to read my article on C Operators and Arrays. In this episode...
     

    BRAINDUMP ARTICLES

    - Internet Explorer 8 Review
    - Nilpo`s Top Windows Add-Ons
    - Beginning Silverlight 2.0 Development using ...
    - Fixing Vista`s Troubles
    - Preparing Windows Images for Mass Deployment
    - The Trouble With Vista
    - Slipstreamed and Unattended Windows Installa...
    - Microsoft Office SharePoint Server
    - Microsoft Office SharePoint Designer
    - Microsoft Windows SharePoint Services 3.0
    - Microsoft Live Mesh Overview
    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT