What is C language & why is it used??
C language is a simple language used to communicate with the compiler or the processor to run a certain instruction (can be anything) for eg:-addition of two numbers or n numbers.
In this site you are going to learn everything about this simple language .
INDEX
- Constants Variables, and Data Types
- Operators and Expressions
- Managing input & output Operations
- Decision making and branching
- Decision making and looping
- Arrays
- Character Arrays & strings
- User-Defined Functions
- Structures & Unions
- Pointers
- File Management in C
- Dynamic memory allocation & Linked lists
- The pre-processor
Constants Variables, and Data Types
C TOKENS
In a passage of text, individual words & punctuation marks are called tokens. Similarly, in a C language the smallest individual units are known as C tokens. C has six types of tokens .C programs are written using these tokens and the syntax of the language.
KEYWORDS & IDENTIFIERS
Every c word is classified as either a keyword or an identifier .All keywords have fixed meaning and these meanings cannot be changed . Keywords serve as basic building blocks for program statements. All Keywords must be written in lowercase
DATATYPES
In C,double is the primary data type for real numbers. This data type permits decimal places; in addition, it can represent numbers that are extremely large or small. ANSI C relies on the individual compiler and its implementation on a specific machine to determine the limits of data types .The range of numbers that can be represented by data type int is relatively small; type long int has a larger range of integers.T
In contratst,a variable with data type double can store a much wider range of values. The exact range varies from compiler to compiler,but almost all allow numbers like positive or negative values ranging from 1.0 x 10^30 to 1.0 x 10^30,from infinitesimal to enormous .
Operators and Expressions
Relational operators
A number of operators can be used to represent the relationship between values they are called relational operators.
Two of these may surprise you. First,the operators to test equality ,called the logical equals operator is ==,This is not the same as the = used in mathematics to compare computer languages for both operations. Someone using such a language much carefully distinguish between the two meanings in a given situation.
Second, the != operator is also different from the symbol used in mathematics (#),In C, you can think of ! as standing for not ,so != is " not equal."
Increment and decrement operators
These for loop headers give us the perfect opportunity to explore other operators in C . Let's look at the third part of the header ,the increment .the increment operator ++,used in number++ to increase the value of number by 1.An expression like number++ can be used in the header of a for loop above to decrement number .The ++ and -- are unary operators , with the same precedence as unary minus and unary operators, with the same precedence as unary minus and unary plus and the same associativity,right to left. Because their use can be complex ,We will employ these operators for now only in simple increment and decrement statements and for loop headers.
No comments:
Post a Comment