C (programming language)

From Citizendium
Revision as of 17:19, 24 February 2007 by imported>Alex Bravo (→‎Analysis)
Jump to navigation Jump to search

C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie and Brian W. Kernighan at the Bell Telephone Laboratories for use with the Unix operating system. It has since spread to every other platform, and is now one of the most widely used programming languages. It has been adapted by ISO and ANSII, and is considered a standard programming language. C has also greatly influenced many other popular languages, especially C++, which was originally designed by Bjarne Stroustroup as an enhancement to C. Due to its basic dual nature, being low-level as well as highly structured, it is the most commonly used programming language for writing system software, though it is also widely used for writing applications.

Syntax

Hello World

#include <stdio.h>

int main() {
   printf("Hello, world!\n");
   return 0;
}

Analysis

This program is the most widely created piece of software ever.

#include <stdio.h> tells the compiler to include the contents of the header file stdio.h, which manages standard input and output, into the program before compiling.

int main { tells the compiler that there is a function named main. The opening curly brace denotes the beginning of the function.

printf("Hello, world!\n"); will make the program output Hello, world! and a new line (\n) on the screen. The semicolon is added to the end of every line such as a function call.

return 0; returns a value from main to the operating system. 0 means success.

} signals the end of the function.