Posts

18. Identifiers and Keyword in C programming

Image
Identifiers & Keywords  Identifier is the fancy term used to mean 'name'. In C, identifiers are used to refer to a number of things: we've already seen them used to name variables and functions. They are also used to give names to some things we haven't seen yet, amongst which are labels and the ‛tags’ of structures, unions, and enums.          Keywords are the special terms reserved for a special purpose in a language, which cannot be used as variable names. Keywords are identifiers reserved by the language for special use. Every keyword has a special meaning. All keywords must be written in lower case letter. C language uses 32 keywords which are not available to users to use them as variables or function names. So keywords are the words whose meaning has already been explained to the C compiler. All the keywords are given below: Keywords in C Language

17. Constants/Literals in C programming

Constants/Literals in C : During the program execution, any unchanged value in a program is known as constant. A constant in C language refers to a fixed value that does not change during execution of a program. C supports following types of constants: (1) Numeric Constants : C language supports two types of numeric constants. They are Integer Constants and Floating point or Real Constants. An integer constant is a signed or unsigned whole number, such that + 25, - 10, 33 etc. where as any signed or unsigned number with fractional part is known as floating point or real constants, such that 0.23, +0.23, - 0.23, 0.23 ÷ 5 (0.23 x 10 to the power 5). (2) Character constant : C language supports two types of character constants. They are Single character constants and String constants. Any letter enclosed in single apostrophe is called single character constant. For example ‛s’ , ‛+’ , ‛$’ etc. where as any string of characters consisting of letters, digits, and symbols enclosed in do

16. Comment Lines in C programming

Comment Lines: In programming, some statements are used for the programmer to understand what he/she has done, in later. They are often called as comment lines. To use a single line comment, we used the ‘ // ’ symbol and for multi-line comment, we used the /* */ symbol. For example, we can write comment lines in the following way, // This line considered as a single line comment. Hence no effect; or /* Multiline The comment looks like this*/

15. Basic Input/output functions in C programming

Basic Input/output functions in C : (1) scanf( ) : It is used to take input from user. scanf( ) is used to read input values of variables by using input devices. The syntax of scanf( ) is given below:                     scanf (“control string control string......”, & variable name 1, & variable name 2, ...... & variable name n) ; (2) printf( ) : It is used to display the output. printf( ) is used to print values of variable by using the output devices. The syntax of printf( ) is given below:                     printf (“control string control string....”, & variable name 1, & variable name 2, .... & variable name n); (3) getchar( ) : It is a character input/output function which reads a character from keyboard at a time. The syntax is as follows:                 char variable=getchar( ); (4) getch( ) : It is a character input/output function which reads a character from the keyboard and it does not expect the enter key press. The syntax is as follows:      

14. Escape Sequences in C Programming

Image
Escape Sequences : It specified with the first argument of printf( ), these are mainly used for screen formatting of the output. Normally escape sequence are some control characters used to move the cursor and print the characters, such as ?,",\ etc.The following table shows the different escape sequences and their meanings: Escape Sequences in C Programming and their meanings

13. Control Strings in C Programming

Image
Control String : It is also known as format specifier.It defines the way in which the arguments used with printf( ) & scanf( ) will be displayed or accepted respectively. It begins with the percent sign and is followed with the format code. The following table depicted the different control string for different data types: Control Strings in C Programming

12. Library Functions of C Programming

Image
  Library Functions : Library functions are built in functions used to perform standard operations.The C language is accompanied by a number of library functions that carry out various commonly used operations or calculations. A library function is accessed by writing the function name, followed by list of arguments that represent information being passed to the function. The arguments must be enclosed in parenthesis and separated by commas. The arguments can be variables or constants. Some C library functions are sqrt(), fabs(), exp(), log(), pow(), sin(), cos(), tan(), floor(), ceil(), etc. Header files and related Libray functions in C programming

11. Variables in C Programming

Variables : In programming, a variable is a container (storage area) to hold data. To indicate the storage area, each variable should be given a unique name (identifier). Variable names are just the symbolic representation of a memory location. For example:                          int playerScore = 95 ; Here, playerScore is a variable of integer type. Here, the variable is assigned an integer value 95. Rules for naming a variable : 1. A variable name can have letters (both uppercase and lowercase letters), digits and underscore only. 2. The first letter of a variable should be either a letter or an underscore. 3. There is no rule on how long a variable name (identifier) can be. However, you may run into problems in some compilers if variable name is longer than 31 characters.

10. Data Types of C Programming

Data Types of C Programming  are given below : A set of values together with a set of permitted operations is known as data  t ypes . Variables used in C programs are declared with appropriate data types before the variable is assigned any value. There are four basic data types in C language. They are described below: (1) char : A char data type is used to hold individual character or letter or symbol. It usually occupies 1 byte in RAM. The value range in decimal in char data types is between - 128 to 127. (2) int : An int data type is used to store a signed or unsigned whole integer number within a specified range and cannot have fractional values or a decimal point. It usually occupies 2 bytes in RAM. The value range in decimal in char data types is between - 32768 to 32767. (3) float : A float data type is used to store floating point numbers or real numbers that is numbers that can have decimal values. It usually occupies 4 bytes in RAM. The value range in decimal in ch

9. Header Files of C Programming

Image
Header Files of C programming : A header file is a file which is generally available in the include directory in the C language . It is an ASCII (American standard code for information interchange) type file . C language uses several header files , each of which contains declaration that are functionally related. For example, <math.h> header file contains declaration for mathematical function. The header files also contained the information about library functions. Some important header files are  <stdio.h>  Standard input output header, <conio.h>  Console input output header,  <math.h> Mathematical header, <string.h>  String manipulation header,  <stdlib.h> Standard library of utility functions header,  <ctype.h> Character  type testing and conversion header , etc . Header files and related Libray functions in C programming

8. Program structure rules of C programming

  Some rules which hold for all programs written in C are as follows: (1) C has no specific rule about the position at which different parts of a statement are to be written. (2) C is a case sensitive programming language. Each and every statement in C or keyword must be written in lower case letter. (3) Each and every statement used in a C program must be terminated with a semicolon. (4) The statements within a function in C program are always enclosed within a pair of brackets. (5) Any C program must be start with a function called main function. (6) The group of statements within main () are executed sequentially. (7) The enclosing brackets of the main () function indicates the end of the program. (8) Keywords cannot be used for any other purpose that is they cannot be used as a variable or function name.

7. Introduction of C programming :

C is a high level, most powerful programming language. It was developed by Dennis Ritchie at AT & T's Bell Laboratories of USA during the 1970's. Basic features of C (1) Machine independence : C programs normally run on many different computers without alteration, provided the appropriate library functions and header files are utilized. (2) Structured programming : C programs are written systematically with the feature of structured programming concept. (3) Flexibility : C has flexible features to write programs for numerical, commercial, and graphical applications. (4) Integrity : This refers to the accuracy of the calculations. C is one of the most popular highly integrated programming languages. (5) Efficiency : Efficiency is concerned with execution speed and memory utilization. Normally programs written in C are efficient and fast.

6. Flowchart of a computer programming

Image
A flowchart is a type of diagram that represents an algorithm, workflow or process. Flowchart can also be defined as a diagramatic representation of an algorithm (step by step approach to solve a task). The flowchart shows the steps as boxes of various kinds, and their order by connecting the boxes with arrows. Symbols for flowchart : Basic structure of a flowchart : Some examples of Flowchart are given below : 1.Flowchart to add two numbers : 2. Flowchart to subtract two numbers : 3. Flowchart to print area of a square :

5. Algorithm of a computer programming

An algorithm is a step by step method of solving a problem. It is commonly used for data processing, calculation and other related computer and mathematical operations.An algorithm is also used to manipulate data in various ways, such as inserting a new data item, searching for a particular item or sorting an item. Some examples of algorithm are given below : 1.  Write an algorithm to add given two numbers. Step 1: Start. Step 2: Read two numbers A and B. Step 3: Total = A+B. Step 4: Display Total. Step 5: Stop. 2.  Write an algorithm for Subtracting two Numbers. Step 1: Start. Step 2: Read two numbers A and B. Step 3: Answer = A - B. Step 4: Display SUB. Step 5: Stop. 3. Write an algorithm to find factorial of a given number. Step 1: Start Step 2: Declare variables: N, fact,  i. Step 3: Initialize variables             fact = 1             i = 1 Step 4: Read value of N from user. Step 5: Repeat following steps until i = N             fact =  fact

4. What is Compiler ?

A compiler is a computer program that translates computer code written in one programming language (the source language) into another programming language (the target language). The name compiler is primarily used for programs that translate source codefrom a high-level programming language to a lower level language (e.g., assembly language, object code, or machine code) to create an executable program .

3. What is programming language ?

Program is a set of commands ( or instructions ) through which we can perform a specific task . A programming language is a language which helps us to write a program . For example , BASIC , C , C++ , Python , JAVA , DOT NET , etc. Computer programming language can be classified as , A. System Programming Language : A programming language that is used to write system software . B. Application Programming Language : A programming language that is used to write application software . It can be further classified as , High Level Language : It is a programming language that permits a programmer to write programs that are more or less independent of a specific computer . They are considered as high level because they are closer to human language and further from machine language . For example , Pascal , Basic , C , C++ , JAVA . Low Level Language : It is a programming language that permits very low abstraction from computer's instruction architecture (CIA) . They are closer

2. Requirement of Computer Programming

You need a programming language in computer programming for the same reason you need a natural language in your everyday life : to communicate and simplify things. How humans interact with each other? using a language , the basic elements of a language are the letters, right? what you do with these letters? you combine them if you say h-o-u-s-e , is a nonsense , but if you say house , people will understand you) so what are you doing in reality? you are using a code in order to access the world outside, this code is your interface on the world. Consider a deaf-mute person, how he/she communicates? he/she uses a code, in this case not the speaking language but the signs language , but for he/she this code has the same function, is an interface on the outside world. The other function of a code is to simplify things , to give them a structure , to help you build more complex things giving you simpler tools. Computer programming is problem solving for the most part. Now , im

1. What is Computer programming ?

Computer programming is the process of designing and building an executable computer program which is basically a sequence of instructions for accomplishing a specific computing task.