+ blank slate external link view note share note all notes
Saving.....
edit make private

CONSTANTS

Constants are named memory locations which hold only one value throughout the program execution. Once the value is executed to the constant, it is fixed throughout the program.

                       **C Constants**
  1. Numeric constant 2. Character constant a. Integer constant a. Character b. Real constant b. String constant

Integer constant

An integer constant can be a decimal integer constant, octal integer constant, or hexadecimal integer. A decimal integer value will be a decimal integer whereas an octal integer value will be prefixed with'0', and a hexadecimal integer value is prefixed with '0X'.

An integer constant can also be an unsigned type of integer constant or a long type of integer constant. An unsigned integer constant value is suffixed with 'u' and a long integer constant value is suffixed with 'l' whereas an unsigned long integer constant value is suffixed with 'ul'.

Floating point constant

A floating-point constant can contain an integer part and a decimal part, it may also contain an exponent part. When the floating-point constant is represented in exponent form the value is suffixed with 'e'or'E'.

Character constant

Character literals are enclosed in single quote(eg.,'x') Character literals can be plain characters, escaped sequences, or universal characters. In c some characters have special characters that are newline(\n), and tab(\t).

String literal

String literals are enclosed in the double quote" ". String constants contain characters that are similar to character literals; plain characters, escape characters, and universal characters. Long lines can be converted into multiple lines using string literals.

Variables

Variables in a C programming language are named memory locations where the user can store different values of the same data types during the program execution. syntax; type variable_list;

Datatype

Datatypes in a C programming language are used to declare what kind of value can be stored in a variable such as int, float, char, etc.,

There are different data types in C programming languages. They are:

  1. Basic Datatype 2. Derived Datatype 3. Enumeration 4. Void

Void type

It is usually used to declared the function that does not return any value. The void type function is declared using the Keyword.

Integer Datatype

It includes whole numbers in the range that excludes floating-point numbers. The keyword is used to declare Integer type variables. eg;15, -10

Floating point types

The floating-point type includes values in the range that supports floating-point numbers. The keyword float is used to declare floating point type variables. eg;0.14,10.135

Character type

Character type can store in a single character. The keyword char is used to declare character-type variables. eg;'5','a'

instructions pdf ( + p)   gdoc ( + g) save ( + s)