This document outlines the objectives and topics covered in the course EC8393 - Fundamentals of Data Structures in C. The course aims to teach students about linear and non-linear data structures and their applications using the C programming language. Key topics include implementing various data structure operations in C, choosing appropriate data structures, and modifying existing or designing new data structures for applications. Assessment includes continuous internal assessments, a university exam, and a minimum 80% attendance requirement.
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to create the UNIX operating system. C is a structured, procedural programming language that is widely used to develop operating systems, databases, networks, and more. The document then covers some key concepts in C including functions, header files, variables, data types, operators, and escape sequences. It provides examples of basic C programs and exercises for practicing programming concepts.
The document provides an introduction to the C programming language. It discusses the basic components of a C program including documentation, header files, definitions, global declarations, the main function, and subprograms. It also covers various C programming concepts such as data types, variables, constants, operators, and sample programs. The document is intended to teach students and professionals the fundamentals of C programming.
The document provides an overview of the C programming language, including its history, basic structure, data types, operators, input/output, decision making, looping, functions, arrays, pointers, strings, structures, file handling, and linked data structures. Some key topics covered include the C compilation process, basic C program structure, common data types like int and char, arithmetic, relational, and logical operators, if/else and switch statements, while, do-while and for loops, defining functions, and passing arguments to functions.
object oriented programming part inheritance.pptxurvashipundir04
The document discusses the key concepts in C++ program development including the Program Development Life Cycle (PDLC), variables and data types, operators, control structures, functions, arrays, pointers, identifiers, and keywords. The PDLC follows an iterative process with phases like planning, analysis, design, implementation, testing, deployment and maintenance. Variables store data of built-in types like integers while functions perform tasks. Arrays store multiple elements in contiguous memory and pointers reference the memory locations of other variables. Identifiers name program elements and keywords are reserved words with special meanings.
The document provides an introduction to the C programming language. It discusses the structure of a C program including character set, tokens, identifiers, reserved words, comments, data types, constants, variables, operators, expressions, statements, functions, and how to convert an algorithm into a C program. It then discusses why C is commonly used, its features such as being robust, portable, supporting dynamic memory allocation, and being efficient and fast. The document outlines the advantages and disadvantages of C and valid steps in a C program. Finally, it provides details on the typical structure of a C program which includes documentation, linking, definitions, global declarations, the main function, and subprograms.
This document provides an overview of embedded systems programming. It discusses that embedded computers are used as part of larger systems to control physical devices. Reliability is often critical and resources are limited. Application areas include microcontrollers, real-time response requirements, and possible organization of embedded systems. C is discussed as a commonly used programming language for embedded systems due to its efficiency, ability to handle low-level activities, and ability to be compiled on different computers.
This document provides an overview of algorithms, flowcharts, hardware, software structure in C programming, and C tokens. It defines algorithms and their properties. It describes flowcharts, their components and examples. It explains hardware components like CPU, memory. It outlines the typical sections of a C program like main(), functions. It defines different tokens in C like keywords, identifiers, operators and provides examples.
C is a general-purpose programming language developed in the early 1970s. It was designed to be compiled using a minimal compiler for portability. C is still widely used today due to its speed, flexibility and ability to access low-level hardware which makes it suitable for system programming tasks like operating systems, language compilers, databases etc. The document provides an overview of the history and evolution of C, why it is still useful, basic C programming concepts like variables, data types, expressions and operators.
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to create the UNIX operating system. C is a structured, procedural programming language that is widely used to develop operating systems, databases, networks, and more. The document then covers some key concepts in C including functions, header files, variables, data types, operators, and escape sequences. It provides examples of basic C programs and exercises for practicing programming concepts.
The document provides an introduction to the C programming language. It discusses the basic components of a C program including documentation, header files, definitions, global declarations, the main function, and subprograms. It also covers various C programming concepts such as data types, variables, constants, operators, and sample programs. The document is intended to teach students and professionals the fundamentals of C programming.
The document provides an overview of the C programming language, including its history, basic structure, data types, operators, input/output, decision making, looping, functions, arrays, pointers, strings, structures, file handling, and linked data structures. Some key topics covered include the C compilation process, basic C program structure, common data types like int and char, arithmetic, relational, and logical operators, if/else and switch statements, while, do-while and for loops, defining functions, and passing arguments to functions.
object oriented programming part inheritance.pptxurvashipundir04
The document discusses the key concepts in C++ program development including the Program Development Life Cycle (PDLC), variables and data types, operators, control structures, functions, arrays, pointers, identifiers, and keywords. The PDLC follows an iterative process with phases like planning, analysis, design, implementation, testing, deployment and maintenance. Variables store data of built-in types like integers while functions perform tasks. Arrays store multiple elements in contiguous memory and pointers reference the memory locations of other variables. Identifiers name program elements and keywords are reserved words with special meanings.
The document provides an introduction to the C programming language. It discusses the structure of a C program including character set, tokens, identifiers, reserved words, comments, data types, constants, variables, operators, expressions, statements, functions, and how to convert an algorithm into a C program. It then discusses why C is commonly used, its features such as being robust, portable, supporting dynamic memory allocation, and being efficient and fast. The document outlines the advantages and disadvantages of C and valid steps in a C program. Finally, it provides details on the typical structure of a C program which includes documentation, linking, definitions, global declarations, the main function, and subprograms.
This document provides an overview of embedded systems programming. It discusses that embedded computers are used as part of larger systems to control physical devices. Reliability is often critical and resources are limited. Application areas include microcontrollers, real-time response requirements, and possible organization of embedded systems. C is discussed as a commonly used programming language for embedded systems due to its efficiency, ability to handle low-level activities, and ability to be compiled on different computers.
This document provides an overview of algorithms, flowcharts, hardware, software structure in C programming, and C tokens. It defines algorithms and their properties. It describes flowcharts, their components and examples. It explains hardware components like CPU, memory. It outlines the typical sections of a C program like main(), functions. It defines different tokens in C like keywords, identifiers, operators and provides examples.
C is a general-purpose programming language developed in the early 1970s. It was designed to be compiled using a minimal compiler for portability. C is still widely used today due to its speed, flexibility and ability to access low-level hardware which makes it suitable for system programming tasks like operating systems, language compilers, databases etc. The document provides an overview of the history and evolution of C, why it is still useful, basic C programming concepts like variables, data types, expressions and operators.
C is a general-purpose programming language developed in the early 1970s. It produces very fast executable code and is widely used for operating systems, language compilers, utilities and other system software. The document provides an overview of the history and development of C, why it is still useful today, basic C programming concepts like tokens, constants, variables and data types, and the overall structure and execution of a C program.
C is a general-purpose programming language developed in the early 1970s. It has been widely used for operating systems, language compilers, text editors and other system-level programs due to its high performance and portability. The document provides an overview of C programming basics including the history of C, why C is still useful today, C character set, tokens, constants, variables, data types, expressions and operators. It also describes the basic structure of a C program and the execution process.
This document provides an introduction to the C programming language. It covers C program structure, variables, expressions, operators, input/output, loops, decision making statements, arrays, strings, functions, pointers, structures, unions, file input/output and dynamic memory allocation. The document uses examples and explanations to introduce basic C syntax and concepts.
The document provides an overview of a computer programming lecture on C programming. It covers the following topics:
1. The history of C and basics of C programming including program structure, data types, and variables.
2. Recommended books for learning C programming.
3. What C is, why it is useful, and its uses in operating systems, databases, device drivers and other applications.
4. The software development method and types of programming languages such as machine language, assembly language, and high-level languages.
The document discusses the process of compiling a C program from source code. It explains that source code is first edited, then compiled to create object code. This object code is then linked with libraries to create an executable file that can be run by the operating system. It also provides details on using functions like main(), printf(), and comments in C programs.
Chapter-2 edited on Programming in Can refer this pptANISHYAPIT
C was developed in the 1970s and is a popular and widely used programming language today. It is well suited for systems programming due to its portability, efficiency, and ability to access hardware. A C program consists of functions written in a logical sequence to perform tasks. Key aspects of C include its small size, support for pointers and structures, and suitability for both low-level and structured programming.
This document provides an overview of the C programming language. It begins with defining what C language is, including that it is a procedural language considered the base for other languages. The history and features of C language are then outlined. The document discusses various applications of C and the compilation process. It also covers editors, compilers, basic C program structure, variables, data types, operators, and common errors in C programming.
The document provides an introduction to algorithms and key concepts related to algorithms such as definition, features, examples, flowcharts, pseudocode. It also discusses different types of programming languages from first to fifth generation. Key points of structured programming approach and introduction to C programming language are explained including data types, variables, constants, input/output functions, operators, type conversion etc.
This document provides an introduction to fundamentals of programming with C#, including definitions of key concepts like algorithms, variables, data types, operators, and conditional statements. It explains that programming involves describing what you want the computer to do as a sequence of steps or algorithms. The stages of software development are outlined as gathering requirements, planning/design, implementation, testing, deployment, support, and documentation. An overview of C# programming language fundamentals is also provided, such as basic syntax structure, defining classes and methods, and using the console for input/output.
This document provides an introduction to computer programming concepts. It discusses what a computer is and its basic components. It then explains programming languages, algorithms, and the basic structure of a program, including headers, constants and variables, data types, subprograms, and the program body. It also gives examples of algorithms and discusses the differences between constants and variables. Overall, the document serves as a foundational overview of key programming concepts.
The document discusses header files and C preprocessors. It defines header files as files containing C declarations and macro definitions that can be shared between source files by including them using the #include directive. Common header files like stdio.h, conio.h, and math.h are given as examples. Preprocessors are described as a macro processor that transforms the program before compilation by handling preprocessor directives like #define. It allows defining macros which are abbreviations for longer code constructs. The document also provides examples of preprocessor directives like #include and #define.
Do you want to learn basic information about the c Language?
Yes!
That’s great.
This pdf is the right choice for you.
Here, I will provide you all the basic information about C language.
You can visit our blog to enjoy our original post.
The document discusses Unit 4 of the Programming for Problem Solving course. It covers functions and pointers in C programming. Specifically, it discusses function declaration, definition, user-defined functions, storage classes, function prototypes, parameter passing methods (call by value and call by reference), recursion, pointers, pointer arithmetic, and dynamic memory allocation using pointers.
- All variables in a C program must be declared before they can be used, specifying a name, value, and type.
- The document discusses basic C programming concepts like variables, data types, comments, functions, and arithmetic expressions.
- It provides examples of C code snippets and explains concepts like preprocessing, compiling, linking, and executing a C program.
The document provides an overview of the C programming language. It discusses why C is a useful language to learn as it is a building block for other languages and allows one to learn about system-level details. It then describes the structure of a C program including functions and main(), and provides examples of simple C programs that print text and perform basic math operations. It also covers C programming basics like data types, comments, identifiers, constants, input/output functions, and defining custom functions.
This document provides an overview of C programming basics including problem formulation, problem solving, and the fundamentals of C programming. It discusses problem formulation as an iterative process involving decomposing problems into appropriate dimensions. It then covers problem solving methods and introduces C programming, describing its features, character set, tokens, variables, data types, operators, and the structure of a basic C program. It provides examples of programming concepts like input/output operations, decision making, looping, and solving simple problems in C.
The document provides information about computing and programming fundamentals. It discusses the programming process, including developing a program through the program development life cycle of planning, coding, testing, and maintaining a program. It also describes algorithms, flowcharts, and pseudocode - tools used to design programs. Algorithms are sets of steps to solve a problem, flowcharts use graphical symbols to represent program logic, and pseudocode uses a simplified language to design programs before coding.
This document provides an introduction to the C programming language. It covers topics such as C program structure, variables, expressions, operators, input/output, program looping, decision making statements, arrays, strings, math library functions, user-defined functions, formatted input/output, pointers, structures, unions, file input/output, dynamic memory allocation, command line arguments, and operator precedence. The document uses examples and explanations to illustrate key concepts in learning C programming.
This document provides an introduction and overview of the C programming language. It begins with an introduction explaining why C is useful and widely used. It then covers basic C program structure and syntax, including header files, variables and data types, expressions, operators, comments, and symbolic constants. The document uses examples throughout to demonstrate concepts like declaring variables, arithmetic operators, and precedence of operators. It also includes a table of contents to help navigate the various topics covered.
Introduction to the c programming language (amazing and easy book for beginners)mujeeb memon
This document provides an introduction to the C programming language. It covers topics such as C program structure, variables, expressions, operators, input/output, program looping, decision making statements, arrays, strings, math library functions, user-defined functions, formatted input/output, pointers, structures, unions, file input/output, dynamic memory allocation, command line arguments, and operator precedence. The document uses examples and explanations to illustrate key concepts in learning C programming.
C is a general-purpose programming language developed in the early 1970s. It produces very fast executable code and is widely used for operating systems, language compilers, utilities and other system software. The document provides an overview of the history and development of C, why it is still useful today, basic C programming concepts like tokens, constants, variables and data types, and the overall structure and execution of a C program.
C is a general-purpose programming language developed in the early 1970s. It has been widely used for operating systems, language compilers, text editors and other system-level programs due to its high performance and portability. The document provides an overview of C programming basics including the history of C, why C is still useful today, C character set, tokens, constants, variables, data types, expressions and operators. It also describes the basic structure of a C program and the execution process.
This document provides an introduction to the C programming language. It covers C program structure, variables, expressions, operators, input/output, loops, decision making statements, arrays, strings, functions, pointers, structures, unions, file input/output and dynamic memory allocation. The document uses examples and explanations to introduce basic C syntax and concepts.
The document provides an overview of a computer programming lecture on C programming. It covers the following topics:
1. The history of C and basics of C programming including program structure, data types, and variables.
2. Recommended books for learning C programming.
3. What C is, why it is useful, and its uses in operating systems, databases, device drivers and other applications.
4. The software development method and types of programming languages such as machine language, assembly language, and high-level languages.
The document discusses the process of compiling a C program from source code. It explains that source code is first edited, then compiled to create object code. This object code is then linked with libraries to create an executable file that can be run by the operating system. It also provides details on using functions like main(), printf(), and comments in C programs.
Chapter-2 edited on Programming in Can refer this pptANISHYAPIT
C was developed in the 1970s and is a popular and widely used programming language today. It is well suited for systems programming due to its portability, efficiency, and ability to access hardware. A C program consists of functions written in a logical sequence to perform tasks. Key aspects of C include its small size, support for pointers and structures, and suitability for both low-level and structured programming.
This document provides an overview of the C programming language. It begins with defining what C language is, including that it is a procedural language considered the base for other languages. The history and features of C language are then outlined. The document discusses various applications of C and the compilation process. It also covers editors, compilers, basic C program structure, variables, data types, operators, and common errors in C programming.
The document provides an introduction to algorithms and key concepts related to algorithms such as definition, features, examples, flowcharts, pseudocode. It also discusses different types of programming languages from first to fifth generation. Key points of structured programming approach and introduction to C programming language are explained including data types, variables, constants, input/output functions, operators, type conversion etc.
This document provides an introduction to fundamentals of programming with C#, including definitions of key concepts like algorithms, variables, data types, operators, and conditional statements. It explains that programming involves describing what you want the computer to do as a sequence of steps or algorithms. The stages of software development are outlined as gathering requirements, planning/design, implementation, testing, deployment, support, and documentation. An overview of C# programming language fundamentals is also provided, such as basic syntax structure, defining classes and methods, and using the console for input/output.
This document provides an introduction to computer programming concepts. It discusses what a computer is and its basic components. It then explains programming languages, algorithms, and the basic structure of a program, including headers, constants and variables, data types, subprograms, and the program body. It also gives examples of algorithms and discusses the differences between constants and variables. Overall, the document serves as a foundational overview of key programming concepts.
The document discusses header files and C preprocessors. It defines header files as files containing C declarations and macro definitions that can be shared between source files by including them using the #include directive. Common header files like stdio.h, conio.h, and math.h are given as examples. Preprocessors are described as a macro processor that transforms the program before compilation by handling preprocessor directives like #define. It allows defining macros which are abbreviations for longer code constructs. The document also provides examples of preprocessor directives like #include and #define.
Do you want to learn basic information about the c Language?
Yes!
That’s great.
This pdf is the right choice for you.
Here, I will provide you all the basic information about C language.
You can visit our blog to enjoy our original post.
The document discusses Unit 4 of the Programming for Problem Solving course. It covers functions and pointers in C programming. Specifically, it discusses function declaration, definition, user-defined functions, storage classes, function prototypes, parameter passing methods (call by value and call by reference), recursion, pointers, pointer arithmetic, and dynamic memory allocation using pointers.
- All variables in a C program must be declared before they can be used, specifying a name, value, and type.
- The document discusses basic C programming concepts like variables, data types, comments, functions, and arithmetic expressions.
- It provides examples of C code snippets and explains concepts like preprocessing, compiling, linking, and executing a C program.
The document provides an overview of the C programming language. It discusses why C is a useful language to learn as it is a building block for other languages and allows one to learn about system-level details. It then describes the structure of a C program including functions and main(), and provides examples of simple C programs that print text and perform basic math operations. It also covers C programming basics like data types, comments, identifiers, constants, input/output functions, and defining custom functions.
This document provides an overview of C programming basics including problem formulation, problem solving, and the fundamentals of C programming. It discusses problem formulation as an iterative process involving decomposing problems into appropriate dimensions. It then covers problem solving methods and introduces C programming, describing its features, character set, tokens, variables, data types, operators, and the structure of a basic C program. It provides examples of programming concepts like input/output operations, decision making, looping, and solving simple problems in C.
The document provides information about computing and programming fundamentals. It discusses the programming process, including developing a program through the program development life cycle of planning, coding, testing, and maintaining a program. It also describes algorithms, flowcharts, and pseudocode - tools used to design programs. Algorithms are sets of steps to solve a problem, flowcharts use graphical symbols to represent program logic, and pseudocode uses a simplified language to design programs before coding.
This document provides an introduction to the C programming language. It covers topics such as C program structure, variables, expressions, operators, input/output, program looping, decision making statements, arrays, strings, math library functions, user-defined functions, formatted input/output, pointers, structures, unions, file input/output, dynamic memory allocation, command line arguments, and operator precedence. The document uses examples and explanations to illustrate key concepts in learning C programming.
This document provides an introduction and overview of the C programming language. It begins with an introduction explaining why C is useful and widely used. It then covers basic C program structure and syntax, including header files, variables and data types, expressions, operators, comments, and symbolic constants. The document uses examples throughout to demonstrate concepts like declaring variables, arithmetic operators, and precedence of operators. It also includes a table of contents to help navigate the various topics covered.
Introduction to the c programming language (amazing and easy book for beginners)mujeeb memon
This document provides an introduction to the C programming language. It covers topics such as C program structure, variables, expressions, operators, input/output, program looping, decision making statements, arrays, strings, math library functions, user-defined functions, formatted input/output, pointers, structures, unions, file input/output, dynamic memory allocation, command line arguments, and operator precedence. The document uses examples and explanations to illustrate key concepts in learning C programming.
Similar to Fundamentals of Data Structures Unit 1.pptx (20)
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
2. • To learn the features of C
• To learn the linear and non-linear data structures
• To explore the applications of linear and non-linear data
structures
• To learn to represent data using graph data structure
• To learn the basic sorting and searching algorithms
2
Course Objective
3. Upon completion of the course, students will be able to
• Implement linear and non-linear data structure operations using C
• Suggest appropriate linear / non-linear data structure for any given
data set.
• Apply hashing concepts for a given problem
• Modify or suggest new data structure for an application
• Appropriately choose the sorting algorithm for an application
3
Course Outcome
4. Pradip Dey and Manas Ghosh,
―Programming in C, Second
Edition, Oxford University
Press, 2011.
4
Text Book
5. Ellis Horowitz, Sartaj Sahni,
Susan Anderson-Freed, -
Fundamentals of Data
Structures in C, Second Edition,
University Press, 2008.
5
Text Book
6. 1. Mark Allen Weiss, ―Data Structures and Algorithm Analysis
in C, Second Edition, Pearson Education, 1996.
2. Alfred V. Aho, John E. Hopcroft and Jeffrey D. Ullman,
―Data Structures and Algorithms, Pearson Education, 1983.
Reference Books
7. 3. Robert Kruse, C.L.Tondo, Bruce Leung, Shashi Mogalla , ―
Data Structures and Program Design in C, Second Edition,
Pearson Education, 2007.
4. Jean-Paul Tremblay and Paul G. Sorenson, ―An Introduction
to Data Structures with Applications, Second Edition, Tata
McGraw-Hill, 1991.
Reference Books
8. Course Assessment
S. No Name of the
Assessment
Nos. Max. Marks Weightage %
1 CIA I 1 100 20 Marks
Note:
(Sum of CIA I + CIA II + CIA
III)
The total 300 Marks will be
converted into 20 Marks
2 CIA II 1 100
3 CIA III 1 100
4 University Exam 1 100 This will be converted into 80
Marks
Internal: 20 Marks Total: 100 Marks
External: 80 Marks
Note: You need to maintain minimum 80% attendance. If
your attendance is less than 80% then you won't be allowed to write your
final exams .
11. • What is a Program?
– The collection of detailed expressions/instructions
that supplied to a computer to perform a specific
task is known as a program.
– Example: Word Processors, Apps, Games, etc.,
• A computer program tells your computer how to do
what you want.
• C is a Programming language designed to create
System Application to interact with the hardware. 11
WHAT IS C PROGRAM?
12. • Objective of developing C Programming
Language:
– Developing an operating system used on multiple
computers.
• C is a lower level than most other languages
– i.e. it creates code that’s a lot closer to what
machines really understand.
• Procedural and Structured programming
Language
12
Why C?
14. • Simple & Structured Programming Language
– provides structured approach (to break the problem
into parts), rich set of library functions, data types
etc.
• Portable
– C programs can be executed on many machines
with a little bit or no change.
• Mid - Level Programming Language
– C is also used to do low-level programming. It is
used to develop system applications such as kernel,
driver etc. It also supports the feature of high level
language. 14
Features of C?
15. • Rich Library
– C provides a lot of inbuilt functions that make the
development fast
• Memory Management
– It supports the feature of dynamic memory
allocation.
• Speed
– The compilation and execution time of C language
is fast.
15
Features of C?
16. • Pointers
– It allows to interact with the memory directly by
using the pointers.
• Recursion
– Can call the function within the function.
– It provides code reusability for every function.
• Extensible
– It can easily adopt new features.
16
Features of C?
17. 17
Basic Structure of a C Program
Documentation Section
Link Section
Definition Section
Global Declaration Section
Main Function Section
Declaration Part
Executable Part
Sub- Program Section
User Defined Function
18. • Documentation Section
– It is a comment block with information which
helps in tracking and identifying the program.
• Link Section
– It provides instructions to the compiler to link
functions from the system library such as #include
directive.
• Definition Section
– It defines all symbolic constants such as using the
#define directive.
18
Basic Structure of C Program
19. • Global Declaration Section
– There are some variables that can be used in more
than one function.
– Such variables are called Global Variables and are
declared in the global declaration section.
• Main Function Section
– Every C Program must have one main function
section.
– Two Parts: Declaration Part & Executable Part
• Declaration Part
– Declares all the variables used in executable part
19
Basic Structure of C Program
20. • Executable Part
– At least one executable part.
– Appear between the opening and closing braces.
– The closing brace is the logical end of the
program.
– All statements ends with a semicolon.
• Sub - Program Section
– The sub program contains all the user defined
functions that are called in the main function.
20
Basic Structure of C Program
21. • The execution of C Programming language
involves a number of tasks/phases.
• To successfully develop an
application/program we need to have a pre-
processor, a compiler, a assembler and a
linker.
• C is a compiled programming language that
means, the code need to convert the source
files (human readable text files) into object
files (which can be understood by the machine:
microcontroller, computer/laptop).
21
How C Programming Language works?
28. • While solving a problem using a computer
program, all the data we want to work should
be stored in computer’s memory and if some
operation is performed, the date need to be
updated in memory.
• In order to store the data in memory, there are
certain ways to store, access and modify data
in computer’s memory.
28
CONSTANTS AND VARIABLES
29. • interest =
𝑝∗𝑛∗𝑟
100
– Here p, n and r Variable Values can Change
– 100 Constant Values will not change
– Interest Variable Name
• Constants are the values of different types that
can write directly in a program.
• Ex: An integer, real number or a sequence of
charactes
• 1000, 3.14, ‘a’, “Hello”
29
CONSTANTS AND VARIABLES
30. • Variables are unique name or identifier for a
section of computer’s memory where we can
fill the data.
• Ex: P,Q
30
CONSTANTS AND VARIABLES
P
Q
Constants and variables
means to store and represent
data.
Data can be of various types.
31. • Data type defines a set of values that a
variable can store along with a set of
operations that can be performed on it.
31
DATA TYPES
Data Types
Derived
Basic Enumeration Void
32. • Data type defines a set of values that a
variable can store along with a set of
operations that can be performed on it.
32
DATA TYPES
Data Types
Derived
Basic Enumeration Void
33. 33
DATA TYPES
Types Data Types
Basic Data Type int, char, float, double
Derived Data Type array, pointer, structure, union
Enumeration Data Type enum
Void Data Type void
34. • To use variables along with data type, a
variable need to be declared first.
• Syntax datatype variable_name;
• Example:
#include<stdio.h>
int main()
{
int a; //Declaration
a=10; //Initialization
printf(“a=%d”,a);
} 34
DATA TYPES
35. Type Size (Bytes) Format Specifier Range
int 2 %d -32768 to 32767
char 1 %c -128 to 127
float 4 %f 3.4E-38 to 3.4E+38
double 8 %lf 1.7E-308 to 1.7E+308
short int 2 %hd -128 to 127
unsigned int 2 %u 0 to 65535
long int 4 %ld
-2147483648 to
2147483647
signed char 1 %c -128 to 127
unsigned char 1 %c 0 to 255
long double 10 %LF
3.4E-4932 to
35
DATA TYPES
36. 36
OPERATORS IN C
• An operator is a symbol that operates on a value or a
variable.
• These values are known as operands.
• For example: + is an operator to perform addition.
• C has a wide range of operators to perform various
operations.
• Arithmetic Operators
• Relational Operators
• Logical Operators
• Assignment Operators
• Bitwise Operators
• Misc Operators
37. 37
OPERATORS
• Arithmetic Operators:
• An arithmetic operator performs mathematical
operations such as addition, subtraction, multiplication,
division etc on numerical values.
–+, -, *, /, %, ++, --
• Assignment Operators:
• An assignment operator is used for assigning a
value to a variable.
– =, +=, -=, *=, /=, %=
38. 38
OPERATORS
• Relational Operators:
• A relational operator checks the relationship between
two operands. If the relation is true, it returns 1; if the
relation is false, it returns value 0.
==, >, <, !=, >=, <=
Relational operators are used in decision making and
loops.
• Assignment Operators:
• An assignment operator is used for assigning a
value to a variable.
– =, +=, -=, *=, /=, %=
40. 40
DECISION MAKING AND BRANCHING
• Instructions of a programs are executed either
– Sequential Manner
– Branching
• “Decision making and branching” is one of the most
important concepts of computer programming.
• Programs should be able to make logical (true/false)
decisions based on the condition provided.
• Controlling the execution of statements based on certain
condition or decision is called decision making and
branching.
41. 41
Condition Satisfied {True}
Condition not Satisfied {False}
Branching
Branch 1
Branch 2
START
Read User Input
Condition ?
Perform Some Tasks
Perform Some Other
Tasks
Show Result
END
42. 42
HOLIDAY TRIP PROBLEM
• Consider the fact that you and some of your friends have
planed to go out for a holiday trip after the Spring
Semester, 2014.
• You have also decided that if you have got received
money 10000 dollars or more from your parent then
your will go out for a foreign trip. Otherwise, if the
allotted money is less than 10000 then you will go out
for a country side trip.
• Now you are supposed to design a program to solve this
problem.
44. 44
DECISION MAKING AND BRANCHING IN C
• C language supports the following decision making
statements.
– if statement
– switch statement
– conditional operator
– goto statement
• These statements are knows as decision making
statements.
• They are also called control statements as the control
the flow of execution.
45. 45
IF STATEMENT
• The if statement is a powerful statement for decision
making and is used to control the flow of execution of
statements.
• It takes the following structure:
– if (test-condition)
• It allows the computer to evaluate the expression first
and then depending on whether the value of the
expression or condition is true or false, it transfer the
control to a particular statement.
47. 47
IF STATEMENT
• The if statement can be implemented if four different
forms depending on the complexity of the conditions to
be tested.
• The four forms are:
– Simple if statement
– If else statement
– Nested if else statement
– Else if ladder
48. 48
SIMPLE IF STATEMENT- STRUCTURE
• The general form of a simple if statement is:
if (test_condition)
{
statement-block;
}
statement x;
• When the condition is true then both the statement block
and the statement-x are executed but in sequence.
49. 49
SIMPLE IF STATEMENT- FLOWCHART
Entry
Test Condition?
Statement
Block;
Statement x;
Next Statement;
True
False
50. ▪ Important things to notice that if you want to control a
single statement using the if condition then no need to
create a block using the curly bracy.
▪ The curly bracy is used to create statement block when it is
necessary to include multiple statements under the same if
condition.
SIMPLE IF STATEMENT
51. Simple if Statement-Example
▪ Example with block of statement:
if (marks>=90)
{
marks=marks+ bonus_marks;
grade=“A+”;
}
printf(“The mark achieved:marks” , %d);
Condition controlled
Statement
52. Simple if Statement
▪Example of single statement:
if (marks>=90)
marks=marks+ bonus_marks;
printf(“The mark achieved:marks” , %d);
Condition controlled
statement
53. Simple if Statement
▪ What happens if multiple statements follows
after the if condition without using the curly
brace?
▪ Answer: Then the statement immediately following the if
condition is considered as the controlling statement of the
if condition. if the condition is true the controlled
statement is executed otherwise not. Rest of the
statements are executed sequentially.
54. if else Statement
▪ If the test condition is true then the true block statements,
immediately following the if statements are executed;
▪ Otherwise the false block statements are executed.
▪ In short either true-block or false-block of statements will be
executed, not both.
▪ But in both cases the control is transferred subsequently to the
statement-x as it is an independent (not controlled by the if
else statement) statement.
▪ It is also called two way conditional branching
55. if else Statement- Structure
▪ The if else statement is an extension of the simple if
statement. The general form is :
if (test_condition)
{
True block statements;
}
else
{
False block statements;
}
statement-x;
57. if else Statement- Example
▪Example with block of statement:
if (marks>=40)
{
marks=marks+ bonus_marks;
grade=“passed”;
}
else
{
marks=marks;
grade=“failed”;
}
printf(“The mark achieved:marks” , %d);
True block statement
False block statement
58. Nested if else Statement
▪ Using “if…else statement” within another “if…else
statement” is called ‘nested if statement’.
▪ “Nested if statements” is mainly used to test multiple
conditions.
▪ It is called nested conditional branching.
59. 59
NESTED IF ELSE STATEMENT- STRUCTURE
• The general form of a nested if
else statement is:
if (test_condition)
{
if(test_condition)
{
statement-
block;
}
else
{
statement block;
}
}
else
{
statement
block;
}
60. Nested if else -Example
if (gender==female)
{
if (age<10)
{
provide free entry;
provide free food;
}
else
{
provide only free entry;
}
}
else
{
statement-block;
}
Nested if else
61. Else if ladder Statement
▪ The word ladder means the staircase. As the name implies
this statement is used to choose right way/paths among
multiple paths.
▪ There is another way of putting if conditions together when
multiway decisions are involved.
▪ A multiway decision is a chain of if conditions in which the
statement associated with an else condition behaves like
another if condition.
▪ Else if ladder is also called 3 way or multiway decision
making statement.
62. Else if ladder- Structure
if (test_condition 1)
statement-1;
else if (test_condition 2)
statement-2;
else if (test_condition 3)
statement-3;
else if (test_condition 4)
statement-4;
…………………………
……….. else if
(test_condition n)
statement-n;
statement-x;
63. Else if ladder- Example
if(Mark>=50 && Mark<60)
{ printf("Your grade is D");
}
else if(Mark>=60 && Mark<70)
{ printf("Your grade is C n");
}
else if(Mark>=70 && Mark<80)
{ printf("Your grade is B n");
}
else if(Mark>=80 && Mark<90)
{ printf("Your grade is A n");
}
else
printf("you have failed");
64. Switch Statement
▪ When one of the many statements is to be selected, then if
conditional statement can be used to control the selection.
▪ However the complexity of such a program increases
dramatically when the number of statements increases.
▪ Fortunately, C has a built in multiway decision making
statement known as switch.
▪ The switch statement tests the value of a given variable or
expression against a list of case values and when a match is
found only then a block of statements associated with that case
is executed.
▪ The general form is given below:
65. Switch Statement-Structure
switch(expression/ value)
{
case value-1:
statement-block-1;
break;
case value-2:
statement-block-2;
break;
…………………
……. case
value-n:
statement-block-n;
break;
default:
default-statement-block;
break;
}
statement-x;
66. Rules for Switch Statement
▪ The switch statement must be an integral type.
▪ Case labels must be constant or constant expression.
▪ Case labels must be unique. No two labels can have the same value.
▪ Case labels must end with colon.
▪ The break statement transfer the control out of the switch
statement.
▪ The break statement is optional. So two or more case labels may
belong to the same statements.
▪ The default label is optional. If present, it will be executed when
the expression does not find a matching case label.
▪ There can be at most one default label.
▪ The default may be placed any where but usually placed at the
end.
▪ It is permitted to nest switch statements.
67. Conditional Operator
▪ The C language has an unusual operator which is useful for
making two way decisions.
▪ This operator is a combination of ? and :
▪ It takes three operands. This operator is popularly known as
the conditional operator.
▪ The conditional operator can be used as the replacement of if
else conditional statement for two way decision making.
68. Conditional Operator
▪ The general structure of conditional operator:
Conditional expression? true-statement 1: false-statement;
▪ The condition is evaluated first. If the result is true then the
statement 1 is executed and its value is returned.
▪ Otherwise statement 2 is executed and its value is
returned.
▪ Example:
flag = (x<0) ? 0 :1;
70. 70
GOTO STATEMENTS
• The goto statement allows us to transfer control of the
program to the specified label.
• Syntax of goto Statement:
goto label;
... .. ... ... .. ...
label:
statement;
71. 71
LOOPING STATEMENTS
In a program, want to print HAI more than Once!!!!!
HAI
HAI
HAI
HAI
HAI
HAI
HAI
HAI
HAI
HAI
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
Printf(“HAI”);
No good
programmer
does this!!!!
72. 72
LOOPS
• Do not need to write the code for 10 times.
• A loop is a piece of code which allows one to execute a
statement or block of statements repeatedly.
• A loop can either be a pre-test loop or be a post-test
loop.
– Pre Test Loop: Entry Controlled Loop
– Post Test Loop: Exit Controlled Loop
Entry Controlled Loop Exit Controlled Loop
Checks the condition first and
then runs the loop body
Executes loop body first and
then checks for a condition
74. 74
WHILE LOOP
• In while loop it checks the condition first, if condition is
true then control goes inside the loop body other wise
goes outside the body.
• Syntax:
while (condition)
{
loop body;
increment or decrement;
}
Start
Condition
Loop Body
Loop Update
Process Results
Stop
If condition is
false
If condition is true
75. 75
WHILE STATEMENTS
• Example
int a=1;
while (a<4)
{
printf(“Hai”);
a++;
}
True
True
2 Hai
3
4
1
a
Hai
Hai
Output
Prints Hai
Increment by 1
True
Prints Hai
Increment by 1
True
Prints Hai
Increment by 1
False
Loop Exists
76. 76
ARRAYS
• An Array is a collection of similar data type value in a
single variable.
• It is a derived data type in C, which is constructed from
fundamental data type of C language.
0 1 2 3 4 5 6 7 8 9
Length of Array 10
First Index Element
(at 5th Index)
Indexes
77. 77
FEATURES OF AN ARRAY
• Arrays have 0 (Zero) as the first index, not 1 (One). In
this example, marks[0] is the first element.
• If the size of an array is N, to access the last element,
the N-1 index is used. In this example, mark[4].
• Suppose the starting address of mark[0] is 2120d. Then,
the address of the mark[1] will be 2124d. Similarly, the
address of marks[2] will be 2128d and so on.
marks[0] marks[1] marks[2] marks[3] marks[4]
78. 78
ARRAY - DECLARATION
• To declare an array in C, need to declare data type and
size of an Array or by initializing it or by both.
Declaration of an Array in C
123 765 1621
1 1 1
1 2 3
1 0 0
0 0 0
0 0 0
3 3
3 3 0
int *a;
int *a;
int *a;
int *a;
int a[3]; int a[3] = {1,2,3} int a[3] = {} int a[3] = {0…1} = 3;
int a[3] = {[0…1]=3}
int a[3] = {0}
int a[3] = {1,1,1}
int a[3] = {1}
79. 79
ARRAY DECLARATION
• Array declaration by specifying the array size:
datatype arrayName[SIZE];
• Examples:
// Array declaration by specifying size
int arr1[10];
// Declare an array of user specified size
int n = 10;
int arr2[n];
• Array declaration by initializing elements:
// Array declaration by initializing elements
int arr[] = { 10, 20, 30, 40 }
// Here Compiler creates an array of size 4.
80. 80
ARRAY DECLARATION
• Array declaration by specifying size and initializing
elements:
• Examples:
// Array declaration by specifying size and initializing
int arr[6] = { 10, 20, 30, 40 }
• In above syntax Compiler creates an array of size 6,
initializes first 4 elements as specified by user and rest
two elements as 0. above is same as "int arr[] = {10, 20,
30, 40, 0, 0}"
81. 81
ARRAY INITIALIZATION
• Initializing is a process to initialize the value in array
variable.
• Initialization of array one by one:
int arr[5];
arr[0]=10;
arr[1]=20;
arr[2]=30;
arr[3]=40;
arr[4]=50;
• Initialization of array at once:
int arr[]={10,20,30,40,50};
82. 82
ACCESSING ARRAY ELEMENTS IN C
• Array elements can be accessed with the help of index
value of an element.
• Array index starts with 0 and goes till size of array -1.
• int arr[]={10,20,30,40,50};
arr[3] // here 3 is index value and it return 40
0 1 3 4 5 6
arr
arr[0];
Array Variable
Index of elements
to be accessed
84. 84
2 DIMENSIONAL ARRAY
• An array of arrays is known as 2D array.
• In 2-dimentional elements are arranged in row and
column format.
• When we are working with 2-dimentional array we
require to refer 2-subscript operator which indicates row
and column sizes.
data-type arrayName [SIZE] [SIZE];
85. 85
2 DIMENSIONAL ARRAY - INITIALIZATION
• There are two ways to initialize a two Dimensional
arrays during declaration.
• int a[2][4] = { {10, 11, 12, 13}, {14, 15, 16, 17} };
or
• int a[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};
int abc[2][2] = {1, 2, 3 ,4 }
/* Valid declaration*/
int abc[][2] = {1, 2, 3 ,4 }
/* Valid declaration*/
int abc[][] = {1, 2, 3 ,4 }
/* Invalid declaration – you must specify second dimension*/
int abc[2][] = {1, 2, 3 ,4 }
/* Invalid declaration – you must specify second dimension*/
86. 86
2 DIMENSIONAL ARRAY
• int a[2][4];
2 Dimensional Array Conceptual Memory Representation
• Here the array is a[2][4], which can be conceptually viewed as a matrix of 2 rows and 4
columns.
• Actual representation in memory as follows:
• Array is on Integer type, so each element would use 4 bytes.
a[0][0] a[0][1] a[0][2] a[0][3]
a[1][0] a[1][1] a[1][2] a[1][3]
a[0][0] a[0][1] a[0][2] a[0][3] a[1][0] a[1][1] a[1][2] a[1][3]
82206 82210 82214 82218 82222 82226 82230 82234
87. 87
2 DIMENSIONAL ARRAY - INITIALIZATION
#include<stdio.h>
int main(){
int disp[2][3];
int i, j;
for(i=0; i<2; i++) {
for(j=0;j<3;j++) {
printf("Enter value for disp[%d][%d]:", i, j);
scanf("%d", &disp[i][j]);
} }
printf("Two Dimensional array elements:n");
for(i=0; i<2; i++) {
for(j=0;j<3;j++) {
printf("%d ", disp[i][j]);
if(j==2){
printf("n");
} } }
return 0;
}
Enter value for disp[0][0]:1
Enter value for disp[0][1]:2
Enter value for disp[0][2]:3
Enter value for disp[1][0]:4
Enter value for disp[1][1]:5
Enter value for disp[1][2]:6
Two Dimensional array elements:
1 2 3
4 5 6
88. 88
STRINGS
• String is a collection of character or group of
character, in a linear sequence which are represented
using double quotes.
• The string in C language is one-dimensional array of
character which is terminated by a null character '0'.
• Examples:
– “Welcome to the world of programming in C”
– “ Hello ECE”
• ‘C’ provides standard library <string.h> that contains
many functions which can be used to perform
complicated operations easily on Strings in C.
89. 89
DECLARATION
• Strings are declared in C in similar manner as arrays.
• Syntax:
– datatype stringname[SIZE];
• Example:
– char s[5];
90. 90
INITIALIZATION
• Strings can be initialized in different ways as follows:
char str[]="abcd"; ///* string size = ‘a'+‘b'+‘c'+‘d'+"NULL" = 5
*/
or
char str[5]="abcd";
or
char str[5]={'a','b','c','d','0'};
or
char str[]={'a','b','c','d','0'};
or
char str[5]={'a','b','c','d','0'};
or
char *c="abcd";
93. 93
IMPORTANT POINTS TO NOTE
• In declaration of string size must be required to mention
otherwise it gives an error.
char str[]; // Invalid
char str[10]; // Valid
• In declaration of the string size must be unsigned integer
value (not -ve or zero value) which is greater than zero
only.
char str[]; // Invalid
char str[0]; // Invalid
char str[-1]; // Invalid
char str[10]; // Valid
94. 94
IMPORTANT POINTS TO NOTE
• In Initialization of the string if the specific number of
character are not initialized it then rest of all character
will be initialized with NULL.
char str[5]={'5','+','A'};
str[0]; ---> 5
str[1]; ---> +
str[2]; ---> A
str[3]; ---> NULL
str[4]; ---> NULL
• In initialization of the string we can not initialized more
than size of string elements.
char str[2]={'5','+','A','B'}; // Invalid
95. 95
IMPORTANT POINTS TO NOTE
• In initialization of the string the size is optional in this
case how many variable elements are initialized it, that
array element will created.
char str[]={'5','+','A','B'}; // Valid
sizeof(str) --> 4byte
• When we are working with character array explicitly
NULL character does not occupies any physical memory
at the end of the character array.
char str[]={'h','e','l','l','o'}; //sizeof(str) --> 5byte
• String data at the end of the string NULL character
occupies physical memory.
char str[]="hello"; //sizeof(str) --> 6 byte
96. 96
STRING FUNCTIONS
• strlen:
– finds the length of a string
– strlen(string);
• strcpy:
– copies one string to another
– strcpy(destination,source)
• strcat:
– concatenates one string at the end of another
– strcat(string_one,string_two);
• strcmp:
– compares two strings lexicographically
– strcmp(string_one,string_two);
97. 97
STRING LENGTH(WITHOUT USING FUNCTION)
#include <stdio.h>
#include <conio.h>
void main()
{
char input_string[50];
int i=0, length=0;
clrscr();
printf("nEnter your text:t");
gets(input_string);
while(input_string[i]!='0')
{
length++;
i++;
}
printf("nThe length of your text is: %d character(s)", length);
getch();
}
Enter your text:
Enter your text: ECE
The length of your text is: 3
character(s)
98. 98
STRING LENGTH (USING STRLEN FUNCTION)
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char input_string[50];
int length;
clrscr();
printf("nEnter your text:t");
gets(input_string);
length=strlen(input_string);
printf("nThe length of your text is: %d character(s)", length);
getch();
}
Enter your text: ECE
The length of your text is: 3
character(s)
99. 99
STRING COPY (WITHOUT USING FUNCTIONS)
#include <stdio.h>
#include <conio.h>
void main()
{
char copy[50], paste[50];
int i;
clrscr();
printf("nEnter your name (to copy):t");
gets(copy);
for(i=0;copy[i]!='0';i++)
{
paste[i]=copy[i];
}
paste[i]='0';
printf("nThe name is (pasted as):t");
puts(paste);
getch();
}
Enter your name: DEV
The name is (pasted as): DEV
100. 100
STRING COPY (USING STRCPY FUNCTION)
#include<stdio.h>
#include<conio.h>
void main()
{
char copy[50], paste[50];
int i;
clrscr();
printf("nEnter your name (to copy):t");
gets(copy);
strcpy(paste, copy);
printf("nThe name is (pasted as):t");
puts(paste);
getch();
Enter your name: DEV
The name is (pasted as): DEV
103. 103
STRING COMPARISION (STRCMP)
#include <string.h>
int main(){
char str1[20],str2[20];
printf("Enter 1st string: ");
gets(str1);//reads string from console
printf("Enter 2nd string: ");
gets(str2);
if(strcmp(str1,str2)==0)
printf("Strings are equal");
else
printf("Strings are not equal");
return 0;
}
Enter 1st string:
Enter 1st string: Hai
Enter 2nd string:
Enter 2nd string: Hai
Strings are Equal