C Programming

 Introduction to C Programming Language

C is a general-purpose, procedural programming language that was developed in the early 1970s at Bell Labs by Dennis Ritchie. It is one of the most widely used programming languages and has had a significant impact on many other programming languages like C++, C#, and Objective-C.

Before we go into further discussions let's understand what the programming language is and why we need a programming language?

Programming Language?

Language: A language is a medium of communication. We humans use natural language to communicate with each other, but we can not communicate or give instructions to a computer using the natural language. So to communicate with a computer system we need a programming language.



Natural Language VS programming language 



Broadly we can divide programming languages into 3 parts:
  • Machine Level PL (uses binary codes)
  • Assembly Level PL (uses mnemonics codes)
  • High-Level PL (very close to natural language)
Examples: C, Cpp, JAVA, C#, Python, and many more

Assembly & High-level Language
As the computer system only understands 0/1 we have to translate both to the low-level (0/1) format


Assembly-level language and High-level language translators.

There are various compilers available for C Language 
  • Code Blocks (http://www.codeblocks.org/downloads/26)
  • Dev C++ (https://sourceforge.net/projects/orwelldevcpp/)
  • Visual C++ (https://code.visualstudio.com)
For the tutorials, I recommend using Code Blocks so that no configurations and further installments are required.

For the details covered above watch this video tutorial if you missed any part:

Hello World Program:

Let's start with the traditional "Hello, World!" program in C. This simple program prints the text "Hello, World!" to the console.

#include <stdio.h>
int main() {
    printf("Hello, World!\n");
    return 0;
}

Explanation:

#include <stdio.h>: 
This line includes the standard input/output library, which provides functions like printf for output.

int main(): 
Every C program must have a main function, and execution starts from here.

printf("Hello, World!\n");: 
This line prints the text to the console. 
\n represents a newline character.

return 0;: 
Indicates that the program was executed successfully.

Try the above example on your compiler first if everything goes fine then go through the topics mentioned below one by one:




No comments:

Post a Comment