C LANGUAGE FUNDAMETALS

Unformatted text preview:

C LANGUAGE FUNDAMETALS Constants The constants in C are applicable to the values that do not change the value during execution of program Syntax const data type var name value Types of Constants Integer Constants Sequence of number 0 to 9 without decimal points Real Constants Often known as Floating points constants The real constants can be written in exponential notation The e separating the mantissa and exponent can be written in lower or upper case Single Character Constants Single character Also Single digit Single symbol white space enclosed within a pair of single quote marks String Constants Sequence of characters enclosed within a double quote marks Combination all kind of symbols Variables Variables is a data name used for storing a data value Its value may be changed during the program execution It can be assigned different values at different times during the execution of a program Variable can declared based on operation Declaring Variables Datatype variablename Initializing Variable Using Assignment operator Datatype variablename value Rules for defining Variables 1 They must begin with a character without spaces but an underscore is permitted 2 Maximum length of a variables up to 31 characters 3 Variables should not C Keywords 4 Variable name may be combination of upper and lower combination Ex SUM sum SUM suM are not same 5 Should not start with digit Data Types Data is collection of characters digital symbols etc The data are used to represent information Data can be classified in various types Basic data types Int Float Derived data types Arrays Pointer Functions User defined types Enumeration Typedef Void data types void signed types when you need to represent both positive and negative numbers Use unsigned types when you only need to represent non negative values Pointers A pointer is a variable that holds the address of another variable Instead of storing a data value directly it stores the location where the data is stored Syntax type pointerName Syntax pointerName variable Structure Union specific mathematical int num 42 Declare an integer variable int ptr num sizeof operator is used to determine the size in bytes of a variable or data type Ex sizeof num Operators An operator in C can be defined as the symbol that helps us to perform some relational bitwise conditional or logical computations on values and variables The values and variables used with operators are called operands Evaluation of Expression In the C programming expression is evaluated based on the operator precedence and associativity When there are multiple operators in an expression they are evaluated according to their precedence and associativity which is the priority of the operators in expression is decided in C language x a b 3 c 2 1 Precedence and associativity https www geeksforgeeks org operator precedence and associativity in c Precedence language an an are The Functions evaluated formatted Formatted Determines the order in which operators are evaluated in an expression It specifies the priority for grouping different types of operators with their operands Associativity Determines the order in which operators with the same precedence in expression Managing the Input and Output Input Output functions read and write all types of data values Input scanf reads all types of data values Output printf print all types of data Unformatted Functions Input Output functions only work with the character data type Input Output getch putch getche putchar getchar put gets Programs largest of three numbers average of 5 numbers calculate the area of a circle The Unformatted enter two numbers and find the smallest out of them by using conditional operator find whether the given number is prime or not accept two values a and b and interchange their values in C language


View Full Document

C LANGUAGE FUNDAMETALS

Download C LANGUAGE FUNDAMETALS
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view C LANGUAGE FUNDAMETALS and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view C LANGUAGE FUNDAMETALS and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?