Internal Structure of C Language

#include < stdio.h >

The first line of the program #include < stdio.h > is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation. #include directives are not C statements. They are commands to the pre-processor which runs prior to the compiler. Their job is to set programs up in a way that makes life easier for the programmer.

For example, any program that uses the print object must contain the extensive setup information found in the conio.h file. The programmer could type all this information into the program, but it would be very time-consuming. So that’s why we use this approach to make the less and efficient way of programming for the developer.

Ads code goes here

Tokens in C

A ‘C’ program is composed of different tokens and a token is either a keyword, an identifier, a constant, a literal string, or a symbol.

For example, statement C below consists of five tokens

Variables and the Assignment Statements in C

Basic Concept:

Variables represent storage locations in the computer’s memory. Values can be stored in them by using an assignment statement.

The most common form of a statement in a program uses the assignment operator, =, and either an expression or a constant to assign a value to a variable:

 variable = expression;
 variable = constant;

 

The symbol of the assignment operator looks like the mathematical equality operator but in C its meaning is different. The assignment statement indicates that the value given by the expression on the right-hand side of the assignment operator (symbol =) must be stored in the variable named on the left-hand side.

READ  10 Causes Why C is the Best Programming Language For Beginners

The assignment operator should be read as “becomes equal to” and means that the variable on the left-hand side has its value changed to the value of the expression on the right-hand side.

Example Program:

This program has a variable.

#include<stdio.h>
#include<conio.h>

 int main ()
 {
    int X;
    X = 5;  
   printf ("X is assigned to value %d ", X);
}

Output Displayed on the compiler
X is assigned to value 5

Literals

A literal is a piece of data that is written directly into a program’s code. A literal is a piece of data written directly into a program’s code. One of the most common uses of literals is to assign a value to a variable. A literal is a piece of data written directly into a program’s code.

One of the most common uses of literals is to assign a value to a variable. In Program the following statement assigned the literal value 5 to the variable number. This can be directly assigned value to a variable without declaring again.

This Is an example of declaring string literals in C.


"hello, dear"
"hello, \
dear"
"hello, " "d" "ear"

Identifiers in C

A variable name should indicate what the variable is used for. An identifier is a programmer-defined name that represents some element of a program.

Variable names are examples of identifiers. You may choose your own variable names in C, as long as you do not use any of the C keywords.

The following table shows us the Examples of Identifiers which are commonly used in c.

identifiers in C
identifiers in C

Input Statement in C

Statement Input and Output are used in C programming to read and write the data. In stdio.h (standard header input/output file) these are embedded. For this reason, there are primarily two Input / Output functions used.

READ  Learn Structures in C

Those are addressed as follows:

#include<stdio.h>
#include<conio.h>

  
int main() 
{ 
    int age; 
  
    printf("Enter your age below in integer foam:"); 
    scanf(“%d”,age);
    printf ("Your age is: ", age); 
  
    getch(); 
} 

Input:
5

Output on Screen:

Your age is: 5

The above program asks the user to input the age. The object scanf is connected to the input device. The age entered by the user is extracted from scanf using the operator and the extracted data is then stored in the variable age present on the right side of the extraction operator.

Share and Enjoy !

Leave a Comment

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