You are on page 1of 11

DEFINITIONS Week 1: Day 1: 1. A compiler directive is a special instruction for the compiler.

A header file contains the declarations of constants, data types, variables, and forward (early) declarations of functions. A stream is a sequence of data flowing from one part of a computer to another. Day 2: C++ Program Components The predefined data types in Borland C++ 4.0 Naming items in Borland C++ 4.0T The #include directive Declaring variables Declaring constants Declaring and prototyping functions Local variables in functions Static variables in functions Inline functions Exiting functions Default arguments Function overloading

Declaring Constants Constants are identifiers that are associated with fixed values.C++ offers constants in two varieties: macro-based and formal. The macro-based constants are inherited from C and use the #define compiler directive.

Local Variable in Function


The local variable in a function exists only when the host function is called. Once the function terminates, the runtime system removes the local variables. Consequently, local variables lose their data between function calls. In addition, the runtime system applies any initialization to local variables every time the host function is called.

Static Variables in Functions


There are a number of programming techniques that require maintaining the values of local variables between function calls. These special local variables are called static variables.

Inline Functions

Function Overloading
This new feature enables you to declare multiple functions that have the same name but different parameter lists. A parameter list is also called the function signature.

DAY 3 Operators and Expressions


Operators are special symbols that take the values of operands and produce a new value. Arithmetic operators and expressions Increment operators Arithmetic assignment operators Typecasting and data conversion Relational operators and conditional expressions Bit-manipulating operators The comma operator

A floating-point number is also known as a real number.

Increment Operators

Increment (++) and decrement (--) operators enable you to increment and decrement, respectively, by 1 the value stored in a variable.

Assignment Operators

The sizeof Operator


-to know the byte size of a data type or of a variable

Typecasting
Typecasting is a language feature that enables you to specify explicitly how to convert a value from its original data type into a compatible data type. Thus, typecasting instructs the compiler to perform the conversion you want and not the one the compiler thinks is needed.

Relational and Logical Operators : and && ,or |, >.>=,<,<=,!,!=.?:

does not support predefined Boolean identifiers. Instead, the language regards 0 as false and a nonzero value as true. variable = (condition) ? expression1 : expression2;

Boolean Expressions
Bit-Manipulation Operators : &,|,^,~,<<,>>
Bit-manipulating operators toggle, set, query, and shift the bits of a byte or a word

The Comma Operator Operator Precedence and Evaluation Direction

DAY 5 The Decision-Making Constructs DAY 8 User-Defined Types and Pointers


The type definition using typedef Enumerated data types Structures Unions Reference variables Pointers to existing variables Pointers to arrays Pointers to structures Using pointers to access and manage dynamic data Far pointers

Type Definition in C++ : typedef

Enumerated Data Types

Structures
Structures enable you to define a new type that logically groups several fields or members.

Unions
Unions are special structures that store members that are mutually exclusive

Reference Variables
Like reference parameters, reference variables become aliases to the variables they access.

Overview of Pointers
An address is a memory location. A tag is the variables name A pointer is a special variable that stores the address of another variable or information. Pointers to Existing Variables

Pointers to Arrays A program variable is a label that tags a memory address. Using a variable in a program means accessing the associated memory location by specifying its name (or tag, if you prefer). In this sense, a variable becomes a name that points to a memory locationa pointer

address of element x[i] = ptr + i * sizeof(basicType) Pointers to Structures

Pointers and Dynamic Memory

Far Pointers

Within a segment you can use near pointers to access data in the same segment. The pointers only store the offset address in the segment and thus require fewer bytes to store their address. By contrast,far pointers store the segment and offset addresses, and thus they require more space. Windows applications use far pointers.

You might also like