Showing posts with label Conditional and ternary operators. Show all posts
Showing posts with label Conditional and ternary operators. Show all posts

Wednesday, May 14, 2008

Conditional & ternary operators

Conditional & ternary operators

The conditional operator? and: are sometimes called ternary operators.

A ternary operator is one which contains three operands.

The general form of ternary operator is:

exp 1 ? exp 2 : exp 3

The operator works as, if exp 1 is evaluated first. If the result is true then exp 2 is executed, otherwise exp 3 is executed.

Saturday, May 10, 2008

Union(Accessing a union member )

Accessing a union member



To access a union member, you can use the same syntax
that you use for structure members.

Example:

code.m, code.x etc.

During execution, we should make sure that the value
of accessing member is currently stored.

Copyright

Copyright © 2008 C Tutorial, All rights are reserved