Introduction
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. C was originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973 to construct utilities running on Unix. It was applied to re-implementing the kernel of the Unix operating system. During the 1980s, C gradually gained popularity. It has become one of the most widely used programming languages, with C compilers from various vendors available for the majority of existing computer architectures and operating systems. C has been standardized by ANSI since 1989 (ANSI C) and by the International Organization for Standardization (ISO).
By design, C provides constructs that map efficiently to typical machine instructions and for that, it is being used to design operating systems and various application software for computer architectures that range from supercomputers to PLCs and embedded systems.
C is an imperative procedural language. It was designed to be compiled to provide low-level access to memory and language constructs that map efficiently to machine instructions, all with minimal runtime support. Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant C program written with portability in mind can be compiled for a wide variety of computer platforms and operating systems with few changes to its source code.
Since 2000, C has consistently ranked among the top two languages in the TIOBE index, a measure of the popularity of programming languages.
Every C program basically consists of a set of functions, and a function called main, which is the first one that is executed at the beginning of the program, calling from it to the rest of the functions that make up our program.C and C++
C and C++ are two of the oldest surviving programming languages. C++ is an enhanced version of the C programming language with an additional feature of being object-oriented. C has been the motivation behind the birth of not only C++ but a multitude of presently popular high-level programming languages to the likes of Java, PHP, and Python.
What is C?
Popularly known as the Father of Modern Programming, C made its first appearance in 1972 and was developed by Dennis Ritchie while working at Bells Labs. Though originally created for making utilities capable to run on the Unix platform, it is now one of the most widely used programming languages in the world.
– The programming language can be used for coding almost anything.
– It is compiled, lightweight, and offers manual memory management.
– C is a good option for embedded devices and system-level code.
In a C program, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one logical entity
Comments are like helping text in your C program and they are ignored by the compiler. They start with /* and terminate with the characters */. The curly braces are used in pairs to indicate where a block of code begins and ends.
In C, every string literal value must be inside the double quotes “…”. In C programs, every statement needs to be terminated by a semi-colon (i.e. ;).
return 0;
printf(“Hello, World”) . “Hello, World” is the string that will be written to the screen.
Simple text editors including vim or gedit on Linux, or Notepad on Windows can be used to write C programs. Cross-platform editors also include Visual Studio Code or Sublime Text can be used.
To run the program, this source file (hello.c) first needs to be compiled into an executable file (e.g. hello on Unix/Linux system or hello.exe on Windows). This is done using a compiler for the C language.
Data types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.
The syntax for declaring variables in C is simple:
type variable_name = value;
Constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals.
Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are enumeration constants as well. Constants are treated just like regular variables except that their values cannot be modified after their definition.
You can use const prefix to declare constants with a specific type as follows const type variable = value;
Comments
Post a Comment