Posts

Showing posts with the label PROGRAMMING IN C

Structure of a C program

Image
Every C program has one or more functions in it. A program always begins by executing the main() function. Each function contains: • A function heading: This consists of a function name followed by an optional list of arguments enclosed in parentheses. • A list of argument declarations, if arguments are included in the heading. Arguments are also called parameters. • A compound statement: This comprises the remainder of the function. • Each compound statement is covered within a pair of braces { }. The braces may contain elementary statements called expression statements. Each expression statement must end with a semicolon (;). ➡️Brief structure      Constant declarations      main() function /* comments*/      variable declarations      executable statements ➡️Format of a C Program      [constant declarations];      [external variable declarations]; returntype      main()   ...

Why Use C ?

Image
There are many high-level languages, such as C, Pascal, BASIC, and Java. These are all excellent languages suited for most programming tasks. Even so, there are several reasons why many computer professionals feel that C is at the top of the list: • C is a powerful and flexible language and places no constraints while writing codes. It is used for projects as diverse as operating systems, word processors, graphics, spreadsheets, and even compilers for other languages. • A wide variety of C compilers and helpful accessories are readily available. • C is a portable language. Portable means that a C program written for one computer system (an IBM PC, for example) can be compiled and run on another system (a DEC VAX system, perhaps) with little or no modification. Portability has been enhanced after its standardization by American National Standards Institute (ANSI) which sets the rules for C compilers. • C is a language of few words, containing only a handful of terms, called keywords, wh...