Saturday, January 27, 2024

LITERALS & CONSTANTS



Literals

The main purpose of literals is to represent fixed values. These fixed values cannot be changed during the execution of the program. Also, you cannot change the values after their definition. You can use the literals directly in your program code.

Types of literals

  • Integer literals  
  • Floating literals
  • Character literals
  • String literals
Constants

A constant is the quantity that does not change. This quantity can be stored at a location in the memory of the computer.
A variable can be consider as a name given to the location in memory where this constant is stored.




Friday, January 26, 2024

VARIABLES IN C

Variables



variable is a named location in the computer’s memory In C programming. That is used to contain a value which can be modified by a program. variable can be form by numerical value and lower-case upper-case characters. But variable first characters can not be form in numerical value or underscore. The names of the variables are case-sensitive. variables have a data the programmer while identity the variable and should give the name type associated with them. 

 

Variable of declaration

When a variable is declared, an instruction is given to the compiler to reserve a storage space in the memory for the variable.  The syntax the declare variables are var_1,var_2, … ,var_n.

For example,
 int total;

Float x,y;

Char ch,abc;

Initialization of Variable


When a variable is declared, the initial value of the variable is undefined. So, the value of the variable should be initialized to a known value after declaring it. Examble of initialization of

Variable:

Float rate=2.59;

Short int breadth=130;

Long int wage=5200;

Char ch =’a’;

Unsigned int num =15u;

Long int value =5461464l;

 

kEYWORDS & IDENTIFIERS IN C

KEYWORDS AND IDENTIFIERS





Keywords


Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier. Keywords are also known as reserved words and we cannot alter the meaning of keywords. Keywords are the basic building blocks for developing C programs.

There are only 32 keywords in standard C and these keywords must be written in lowercase.

Identifier

Identifier refers to name given to entities such as variables, functions, structures etc.

Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program. 

Rules for Naming Identifiers in C

  • A valid identifier can have letters (both uppercase and lowercase letters), digits and underscores.

  • The first letter of an identifier should be either a letter or an underscore.
  • You cannot use keywords like int, while etc. as identifiers.
  • There is no rule on how long an identifier can be. However, you may run into problems in some compilers if the identifier is longer than 31 characters.


Tuesday, January 23, 2024

STRCTURE OF C PROGRAMMING

Structure Of C








 #include<stdio.h>

 int main ()

 {

    printf("WELCOME TO C PROGRAMMING");

    return 0;

 }


1. #include<stdio.h> 

This is the main header file preprocessor function, which preprocesses standard input and output header files from the C library repository, such as stdio.h, before compiling the programme.

2. int main() 

This C statement, like most programming languages, is the main function, which is the point where the programme execution begins. Once the primary main () has been executed, all other methods and functions are performed.

3.

Curly braces are a type of bracket that can be seen in any computer language, not just C. This represents the start of a method or function definition.

4./* explanation of C code    */

The text inside the /* and */ tags will be considered as comments and will not be executed or compiled. This is to provide the coder with a clear knowledge of the code and its application or use.

5.printf

The output is printed to the console screen using this C command.

6. return 0

This C function returns 0 after terminating the C programme or main function.

7.}

The function or method block is closed with these curly braces.


Monday, January 22, 2024

INTRODUCTION TO C PROGRAMMING LANGUAGE

WHY YOU SHOULD LEARN C AS YOUR FIRST LANGUAGE?


C is powerful programming language that enables developers to create sophisticated software systems. The language is fast, efficient and easy to learn, making it a popular choice for many applications. c is also portable, meaning that programs written in c can be easily ported to other platforms.



HISTORY OF C

The C programming language was developed by Dennis Ritchie at the Bell laboratories in 1972. C is strongly associated with UNIX operating system, which at the time required applications to be written in assembly language, programmers needed a more use-friendly set of   instructions. Assembly programs, which communicate directly with a   computer's hardware, are lengthy and complex to debug, and adding     new functionality requires a lot of time and effort.

KEY FEATURES OF C

  • C program syntax is easy to learn and read; this makes debugging code more accessible and faster.
  • C programs are relatively short compared to other languages, which reduces the time needed to complete them.
  • C is a powerful programming language that enables developers to create sophisticated software systems.
  • The language is fast, efficient, and easy to learn, making it a popular choice for many applications.
  • C is also portable, meaning that programs written in C can be easily ported to other platforms.
  • C has been around for many years , so many libraries and tools are available that facilitate its use.





Saturday, January 20, 2024

WHAT IS PROGRAMMING ?






Programming refers to a technological process for telling a computer which tasks to perform in order to solve problem. You can think of programming as a collaboration between humans and computers, in which human create instructions for a computer to follow(code) in a language computer can understand.

High-Level Languages

High-level languages are designed to be human-readable and easier to understand and write compared to low-level languages. These languages provide abstractions and built-in functionality that allow developers to focus on solving problems rather than dealing with low-level details.

Basis of Translating and Executing Programming


Interpreted Languages

Interpreted languages are executed line by line, directly by an interpreter program without prior conversion to machine code. The interpreter reads each line of code, analyzes it, and performs the corresponding actions in real-time.


Compiled Languages


Compiled languages go through a separate compilation phase before execution. The source code is translated entirely into machine code by a compiler, producing an executable file that can be directly executed by the computer’s processor.