Some common rules for writing C program
Remember Some common rules for writing C program
- Use all commands or statements in lower or small case.
- After completion of a statement excluding main() or loops must insert ; (semicolon) as a statement terminator.
- Don’t use/declare identifier or variable name same as statement name suppose int include; this is a wrong statement because include has a special meaning in the language.
- Header Files or Preprocessor Directives contains references or links of library functions. That is built-in in the C language.
Suppose if you want to use a function clrscr() ; in the main function so must be declared on top # include other wise you could have an prototype error.
Some header files are as follows
- Stdio.h
- Conio.h
- Dos.h
- String.h
- Stdlib.h
And many more header files are available in C…
void main(void)
Every C programs consists of one or more functions. No matter how many
functions there are in a C program , main is the one to which control is passed
from the operating system when the program is run ; it is the first function
executed. The word “void” preceding “main” specifies that the function main()
will not return a value. The second “void,” in parenthesis , specifies that the
function takes no arguments.
printf()
printf() is built-in function we can display with printf() any message, variable
value on screen/file/printer.
In printf() we can use many escape sequences and format specifies.
Escape sequences are special notations through which we can display our data
Variety of ways:
Some escape sequences and their functions are as follows:
Escape Sequence Description Example
\n Perform line feed & Carriage return operation printf(“A\nB”);
\t Prints a tab sequence on screen printf (“A\tb”);
\’ Prints a single quote character on screen printf (“\’a\’”);
\” Prints a double quote character on Screen printf (“\”a\”");
\r Perform carriage return operation printf (“a\rb”)
\b Remove one character from left printf (“a\bHi!” );
C-LANGUAGE NOTES
Some words about Computer Programming languages
Naturally a language is the source of communication between two persons, and also between person to machine like computer. The languages we can use to communicate with the computer are known as Computer programming languages.
Generally there are two major types of languages are available are as follows:
1. Low level languages
2. The set of commands available in low level is complex and not easy to understandable. In this category ” Assembly ” and ” machine codes ” are available. Assembly programs are faster than other high-level language programs.
3. High level languages
• The set of commands available in high level language is very simple and easy to understandable.
High level languages are further divided into two major categories.
1. Procedure Oriented language
2. In this category we are able to create our project or programs using procedural approach means in this type we can able to divide our big project/program into small subroutines or procedures. After making procedures we can able to call a ‘procedure’ one or more places.
The lists of procedural languages are as follows:
C language
C++ (Object Oriented)
Java (Objected Oriented)
Smalltalk (Objected Oriented)
Pascal language
3. Non-Procedural Languages: This category also known as ‘Problem Oriented languages’. In this type of languages we can able to make program only at specific range like database. The followings are the examples of Non procedural languages
1. SQL (Structured Query Language)
2. SNOBOL (String processor)
-
Recent
-
Links
-
Archives
- September 2009 (2)
- March 2008 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS