Best Computer Institute in Pitampura, Delhi, Learn from Industry Experts.

webmailveridical 20 views 44 slides Oct 19, 2024
Slide 1
Slide 1 of 44
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44

About This Presentation

Exploring C Language: The Backbone of System Programming, Part 1 | C Language | Programming #coding
Dive into the world of system programming with C. Find out how this high-level language helps in developing operating systems, kernels, and system utilities.
For more info Contact us:
+91 9319593915
...


Slide Content

// Programming Language “C”

// What is “C” Programming Language C is a general-purpose, procedural, high-level programming language used in the development of computer software and applications, system programming, games, and more.

C language was developed by  Dennis M. Ritchie  at the Bell Telephone Laboratories in  1972 . It is a powerful and flexible language which was first developed for the programming of the  UNIX operating System . C is one of the most widely used programming languages.

// It can be defined by the following ways: Mother language System programming language Procedure-oriented programming language Structured programming language Mid-level programming language

// C as a mother language C language is considered as the mother language of all the modern programming languages because  most of the compilers, JVMs, Kernels, etc. are written in C language , and most of the programming languages follow C syntax, for example, C++, Java, C#, etc. It provides the core concepts like the  array ,  strings ,  functions ,  file handling , etc. that are being used in many languages like  C++ ,  Java ,  C# , etc.

// C as a system programming language A system programming language is used to create system software. C language is a system programming language because it  can be used to do low-level programming (for example driver and kernel) . It is generally used to create hardware devices, OS, drivers, kernels, etc. For example, Linux kernel is written in C. It can't be used for internet programming like Java, .Net , PHP, etc.

// C as a procedural language A procedure is known as a function, method, routine, subroutine, etc. A procedural language  specifies a series of steps for the program to solve the problem . A procedural language breaks the program into functions, data structures, etc.

// C as a structured programming language A structured programming language is a subset of the procedural language.  Structure means to break a program into parts or blocks  so that it may be easy to understand. In the C language, we break the program into parts using functions. It makes the program easier to understand and modify.

// C as a mid-level programming language C is considered as a middle-level language because it  supports the feature of both low-level and high-level languages . C language program is converted into assembly code, it supports pointer arithmetic (low-level), but it is machine independent (a feature of high-level). A  Low-level language  is specific to one machine, i.e., machine dependent. It is machine dependent, fast to run. But it is not easy to understand. A  High-Level language  is not specific to one machine, i.e., machine independent. It is easy to understand.

// C Program A ll C programs are given with C compiler so that you can quickly change the C program code.

// History of C Language History of C language  is interesting to know. Here we are going to discuss a brief history of the c language. C programming language  was developed in 1972 by Dennis Ritchie at bell laboratories of AT&T (American Telephone & Telegraph), located in the U.S.A. Dennis Ritchie  is known as the  founder of the c language . It was developed to overcome the problems of previous languages such as B, BCPL, etc.

// Simple C is a simple language in the sense that it provides a  structured approach  (to break the problem into parts),  the rich set of library functions ,  data types , etc.

// Machine Independent or Portable Unlike assembly language, C programs  can be executed on different machines  with some machine specific changes. Therefore, C is a machine independent language.

// Mid-level programming language C is  intended to do low-level programming . It is used to develop system applications such as kernel, driver, etc. It  also supports the features of a high-level language . That is why it is known as mid-level language.

// Structured programming language C is a structured programming language in the sense that  we can break the program into parts using functions . So, it is easy to understand and modify. Functions also provide code reusability .

// Rich Library C  provides a lot of inbuilt functions  that make the development fast.

// Memory Management It supports the feature of  dynamic memory allocation . In C language, we can free the allocated memory at any time by calling the  free()  function.

// Speed The compilation and execution time of C language is fast since there are lesser inbuilt functions and hence the lesser overhead.

// Pointer C provides the feature of pointers. We can directly interact with the memory by using the pointers. We  can use pointers for memory, structures, functions, array , etc.

// Recursion W e  can call the function within the function . It provides code reusability for every function. Recursion enables us to use the approach of backtracking.

// Extensible C Language is extensible because it  can easily adopt new features .

// First C Program The  general architecture  of a simple  C program  typically consists of several vital components.

// Header Files: The  #include directives  at the beginning of the program are used to include  header files. Header files  provide function  prototypes  and  definitions  that allow the C compiler to understand the functions used in the program.

// Main Function: Every  C program  starts with the  main function . It is the program's entry point, and execution starts from here. The  main function  has a  return type  of  int , indicating that it should return an integer value to the operating system upon completion.

// Variable Declarations: Before using any variables, you should declare them with their data types. This section is typically placed after the main function's curly opening brace.

// Statements and Expressions: This section contains the  actual instructions  and  logic  of the program. C programs are composed of statements that perform  actions  and  expressions  that compute values.

// Comments: Comments  are used to provide  human-readable  explanations within the code. They are not executed and do not affect the program's functionality. In C, comments are denoted by  //  for  single-line comments  and  /* */  for  multi-line comments .

// Functions: C programs can include  user-defined  functions and  blocks  of code that perform specific tasks. Functions help modularize the code and make it more organized and manageable.

// Return Statement: Use the  return statement  to terminate a function and return a value to the caller function. A  return statement  with a value of   typically indicates a successful execution in the  main function , whereas a  non-zero value  indicates an error or unexpected termination.

// Standard Input/Output: C has  library functions  for reading user  input ( scanf )  and printing output to the console  ( printf ) . These functions are found in C programs and are part of the standard I/O library ( stdio.h  header file). It is essential to include these fundamental features correctly while writing a simple C program to ensure optimal functionality and readability.

// Preprocessor Directives: C programs often include  preprocessor directives  that begin with a  # symbol . These directives are processed by the preprocessor before  actual compilation  and are used to include  header files, define macros , and perform  conditional compilation .

// Data Types: C supports data types such as  int, float, double, char , etc. It depends on the program's requirements, and appropriate data types should be chosen to store and manipulate data efficiently.

// Control Structures: C provides  control structures  like  if-else, while, for , and  switch-case  that allow you to make decisions and control the flow of the program.

// Error Handling: Robust C programs should include  error-handling mechanisms  to handle unexpected situations gracefully. Techniques like exception handling (using  try-catch  in  C++ ) or returning  error codes  are commonly employed.

// Modularization: As programs grow in complexity, it becomes essential to modularize the code by creating separate functions for different tasks. This practice improves code reusability and maintainability. Remember, the architecture and complexity of a C program can vary significantly depending on the specific application and requirements. The outline is a general overview of a simple C program's structure.

// First Program In C #include < stdio.h >     int  main(){     printf ("Hello C Language");     return  0;    } 

TYPES DESCRIPTION Primitive Data Types Primitive data types are the most basic data types that are used for representing simple values such as integers, float, characters, etc. User Defined Data Types The user-defined data types are defined by the user himself. Derived Types The data types that are derived from the primitive or built-in datatypes are referred to as Derived Data Types.

// Void Data Type The void data type in C is used to specify that no value is present. It does not provide a result value to its caller. It has no values and no operations. It is used to represent nothing. Void is used in multiple ways as function return type, function arguments as void, and  pointers to void .

// Example // function return type void void exit(int check); // Function without any parameter can accept void. int print( void ); // memory allocation function which // returns a pointer to void. void *malloc ( size_t size);

Return zero If don’t pass it it automatically assume that return type is zero And run the code

#include < stdio.h > int main() { return 10; } The output of this code is not visible since there is no explicit output to the console. However, when this program is run, it will return an exit status of 10. Depending on the environment in which it is executed, this exit status may or may not be displayed. If you run this program from a command line and immediately check the exit status using

Programming Language “C” 9319593915 Aggarwal Prestige Mall, 5th Floor-512, Rd. Number 44, Rani Bagh, Pitampura, Delhi-110034 www.veridicaltechnologies.com