Posts

Showing posts from August, 2015

Basic Structure of a C Program

A C program generally has the following parts: §   Preprocessor Commands §   Functions §   Variables §   Statements & Expressions §   Comments Let us consider a C Program: #include<stdio.h> void main() { printf("Hello, World!"); } Preprocessor Commands: These commands tells the compiler to do some preprocessing before executing the actual compilation. For example, “#include <stdio.h>” is a preprocessor command which tells a C compiler to include stdio.h file before going to actual compilation. Functions:  These are main building blocks of any C Program. Every C Program will at least have one function which is a mandatory function called main() function. This function is prefixed with keyword int or void or any other datatype. This defines the return type of the function. For int main() the program will return an integer value to the terminal (system). The C Programming language provides a set of built-in functions. In the above example printf() is a C b

Get your hands dirty

The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages: Print the words hello, world! In C, the program to print `` Hello, world! '' is #include <stdio.h> main() { printf("Hello, world!\n"); } Just how to run this program depends on the system you are using.

Basics of C

What Is C? C is a highly flexible and adaptable language. Since its creation in 1970, it's been used for a wide variety of programs including firmware for micro-controllers, operating systems, applications, and graphics programming. When was C developed? C was developed at Bell Laboratories in 1972 by Dennis Ritchie along with Ken Thompson. Many of its principles and ideas were taken from the earlier language B and B's earlier ancestors BCPL and CPL. Who is the inventor of C? Dennis Ritchie invented C, the computer-programming language that underlies Microsoft Windows, the Unix operating system and much of the other software running on computers around the world. Mr. Ritchie was a longtime research scientist at Bell Labs, originally AT&T's research division.