Welcome to C-Language!

C is a “Procedural programming” supporting structured programming. C is parent of all programming languages. C has given some concepts which adopted by all other programming languages.

History

C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972.

Use Case

C was initially used for system development work, particularly the programs that make-up the operating system.

Editors

This will where the program is written and executed. There are several editors for C-C++ language like TurboC3, Codeblock, Visual Studio etc.

Basics of C

C-Language is encoding by ASCII(American Standard Code for Information Interchange).ASCII created encoded design for computer keyboards which is called as ASCII Table.

http://www.asciitable.com/index/asciifull.gif

Here is the simple c program for printing hello world.

hello.c `#include<stdio.h>

int main() {

/* my first program in C */

printf(“Hello, World! \n”);

return 0;

}`

Phases of C

The C language is based on compiler. The compiler is like a translator. It translate the source code which is called as High Level Code to the Machine Code(Low Level Code) which is called as ASCII Code.
After completing Compiling phase hello.obj file will generated. This is the binary file which will be executed by C. If there are any Syntax(Grammer) has error than the file is not created.
Syntax errors: Errors that occur when you violate the rules of writing C/C++ syntax are known as syntax errors. This compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by compiler and thus are known as compile-time errors. … This causes a syntax error.
The output is generated after the execution phase is cleared. In this phase it will create hello.exe file which can be executed in the Windows Command Prompt.

https://raw.githubusercontent.com/sumitprojects/C-Language/master/C%20Working.png?token=AIY5IDTVRJRLHQLIIZK3WYS6K2FDE

C - Syntax

Syntax is nothing but the grammer of the language. In order to get output the set of rules must be followed any programming language. C has created some rules which widely used by languages like Java, PHP, Python etc. In C it is called as Tokens.

The Code concept of C is based on 3 parts.

  1. Headers
  2. Main
  3. Logic

https://raw.githubusercontent.com/sumitprojects/C-Language/master/Untitled%20Diagram.png?token=AIY5IDTVRJRLHQLIIZK3WYS6K2FDE

Token is a smallest individual unit in C program.

Semicolon ; :

; is like terminator of the line. In C the statement must be ended with ; .If the ; is missing then it leds to syntax error.

Comments

Comments are plain simple text in a C program that are not compiled by the compiler.

There are two ways in which we can write comments.

  1. Using // This is used to write a single line comment.
  2. Using /* */: The statements enclosed within /* and */ , are used to write multi-line comments.
comments are generally used for documenting the code. Another use of comment is to disable the code/statement which you don’t wan’t to compile.

Basics

Datatypes

Datatype is representation of the data. C - Language understand only two types of data. Numbers and Characters(Symbols). Numbers type has two types : Non Fractional and Fractional Basic Datatypes of C are:

| Types | Formats | Specification | Limits | |——– |——— |——————– |———————————————– | | int | %d | Number +1 -1 | (-32,768 to 32,767) | | float | %f | Number +1.02 -1.02 | (-32,768 to 32,767) (6 digit precision) | | long | %ld | Number +1 -1 | (-9223372036854775808 to 9223372036854775807) | | double | %lf | Number +1.02 -1.02 | 15 decimal places | | char | %c | Symbol | 1 character | | char | %d | ASCII | 1 character |