Introduction To C Language

By:


Brian Kernighan and Dennis Ritchie prepared The C Programming Language in between 1969 and 1973 at AT&T Labs. It is the combination of B Language and BCPL (Basic Combined Programming Language) Language. C language depends on ANSI (American National Standard Institute). ANSI is a standard that is made for every compilers working in same manner. This standard tells what the language should do and what is happening.

Characteristics of C Language:-

1) C is a middle level Language:- it supports both features of high level language and low level language
2) C is a case sensitive language:- it means a and A are different for C compiler
3) Portability:- it means C Language can be transferred from one system to another easily
4) Extendibility:- It means that user can write a number of functions, subprogram according to requirements.

The Simplest C Program

#include
int main()
{
printf("This is output from my first program!\n");
return 0;
}
When executed, this program instructs the computer to print out the line "This is output from my first program!" -- then the program quits.

The Simplest C Program: What's Happening?

This C program starts with #include . This line includes the "standard I/O library" into your program. The standard I/O library lets you read input from the keyboard (called "standard in"), write output to the screen (called "standard out"), process text files stored on the disk, and so on. It is an extremely useful library. C has a large number of standard libraries like stdio, including string, time and math libraries.
A library is simply a package of code that someone else has written to make your life easier.

The line int main() declares the main function. Every C program must have a function named main somewhere in the code. We will learn more about functions shortly. At run time, program execution starts at the first line of the main function.

In C, the { } symbols mark the beginning and end of a block of code. In this case, the block of code making up the main function contains two lines.

The printf statement in C allows you to send output to standard out (for us, the screen). The portion in quotes is called the format string and describes how the data is to be formatted when printed. The format string can contain string literals such as "This is output from my first program!," symbols for carriage returns (\n), and operators as placeholders for variables (see below). If you are using UNIX, you can type man 3 printf to get complete documentation for the printf function. If not, see the documentation included with your compiler for details about the printf function.

The return 0; line causes the function to return an error code of 0 (no error) to the shell that started execution.



About the Author:
The Huge collection of Tricks Containing PC Trick,facebook tricks and windows tricks.After reading this Tricks COllection you are able to secur your on line account and your computer



Article Originally Published On: http://www.articlesnatch.com


|

Loading...
Related....
Videos...

Recent Computers-and-Technology Articles

Comments

Still can't find what you are looking for? Search for it!

Loading

Copyright 2005-2011 ArticleSnatch, LLC - All Rights Reserved.
Privacy Policy | Terms of Service.