CPP

170
1744 reads

January 30, 2013

2-D array declaration


In this example, we have declared and initialized a 2-D array arr[2][3] of int datatype with 2 rows and 3 columns.

396
5317 reads

January 29, 2013

Bitwise AND operator


The bitwise AND operator is a single ampersand: &.It works on bits and not on bytes, chars, integers, etc. It does the logical AND of the bits in each position of the numbers in its binary form.

341
2984 reads

January 29, 2013

Logical AND Operator


It is used to check for 2 or more logical expressions.
If both operands or logical expressions have values of true, the result has the value true. Otherwise, the result has the value false.

372
3827 reads

January 29, 2013

Conditional operator


Basic syntax --> (logical expression/condition)? statement1:statement2.
If expression is true, statement 1 is executed else statement 2 is executed. It is an alternative to if else statement.

29
1684 reads

January 29, 2013

Unary operators


Unary operator are used to operate on a single operand.
Increment(++) and Decrement(--) operators are used to add 1 to the operand and subtract 1 from the operand respectively.

40
1698 reads

January 29, 2013

Scope Resolution Operator


The two declarations of x refer to two different memory locations. The global x is altogether different from the x that is local to main().

40
1618 reads

January 29, 2013

Binary Operators


Binary operators are used to operate on exactly two operands. +,-,*,/ and % are most commonly used Binary arithmetic operators.

39
1585 reads

January 29, 2013

Playing Basic Array


Simple string program that will output the array position of letter from the given string.

Example:
Enter word : Today
Find the position of letter : y
y is at position 5

277
3179 reads

January 29, 2013

Initializing variables with Operators


A cool trick with variables and pre-increment/decrement operators. This implements the initialization of variables with pre-increment/decrement operations.

25
1701 reads

January 28, 2013

Auto or default variable storage


It is default nature of a variable in c++.Every time it is declared it is initialized to the default value.