360 Digital Gyaan

C Language

C language is the programing language developed in the 1970s by Dennis Ritchie and Bell Labs. During the 1980s, C gradually gained popularity and it became the most widely used programing language at that time because of its compiler that was available for all kinds of modern computers. By 1989s C language was been standardized by ANSI and ISO.

Because it supports both low-level and high-level language features, C is regarded as a middle-level language. Programs written in C are translated into assembly code, which enables low-level pointer arithmetic but is hardware independent (a feature of high-level).

A low-level language is dependent on a single machine and is therefore machine-specific. It requires a machine and runs quickly. But understanding it is challenging.

A High-Level language is machine independent since it is not tied to any one particular machine. It is simple to comprehend.

C language

Compiler

If you are not familiar with the word compiler let me, explain it to you. As you know that computers only understand binary numbers (0,1), and the programing language is in the form of simple English. The compiler is the tool that converts the programing language that is written in English to binary form so that the computer could be able to understand our instructions.

Programing Language

Computers only understand binary numbers (0,1), so it is difficult for humans to give instructions to the computer in the form of binary numbers. As a result, programming languages came into existence. So now whenever we have to give any command to the computer, we write it in programing language by following some set of rules. If we don’t follow these rules there will be an error in the program and the computer would not be able to understand our instructions. A few examples of programming languages are -: C, C++, Python, Ruby, Java, etc.  

Basics of C

C language is the key sensitive language which means that the format of writing code should be exactly the same for all the programs as in standard code to avoid an error.

What are variables in C

Variables can be defined as the containers that hold data that is provided to the system. There are many variables type in the C language. Some of them are -:

  • Int ——> This variable is for entering integer data in the program.
  • Float ——> This variable is for entering decimal data in the program.
  • Char ——> This variable is to enter character data in the program.
  • Double ——> This variable is to enter big decimal values in the program.

What are Functions in C

In simple words, the function is a set of statements that takes inputs, then performs some computation, and produces the output according to the instructions.

Syntax of function in C

Return_type Function_name (Set_of_input).

Why functions are used

There are mainly two important reasons why we use functions.

  • Reusability
  • Abstraction

Reusability

Once the Function is defined, we can use them as many times as we want.

Abstraction

If you are using the function in your program then you don’t have to worry about how it works inside or what is its process of completing the task.

C language also has many reserved words

These are the words that can only be used for the purpose which is predefined to them, using them for other purposes will cause an error. Some of these words are-:

  • Auto
  • Break
  • Case
  • Char
  • Const
  • Continue
  • Default
  • Do
  • Double
  • Else
  • Extern
  • Float
  • For
  • Goto
  • If
  • Int
  • Long
  • Return
  • Short
  • Static
  • Switch
  • While

There are many other predefined words other than those mentioned above that have their own predefined function in the C program. 

Now Let’s Write Our First C Program

HELLO WORD program

#include<stdio.h>

Int main ()

{

Printf(“ HELLO WORD ”);

Return 0;

}

Second Program

To find the sum of two numbers-

#include<stdio.h>

Int main()

{

Int a,b,sum;

Printf(“ enter the first number ”);

Scanf(“%d”,&a);

Printf(“ enter the second number ”);

Scanf(“%d”,&b);

Sum=a*b;

Printf(“ The sum is : %d”,sum);

Return 0;

}

If you want to learn more in detail CLICK HERE.

Add Your Heading Text Here

1 thought on “C Language”

  1. Pingback: #1 WHAT IS ARTIFICIAL INTELLIGENCE OR (AI)??

Leave a Comment

Your email address will not be published. Required fields are marked *