This document provides an overview of pointers in C programming. It discusses seven rules for pointers, including that pointers are integer variables that store memory addresses, how to dereference and reference pointers, NULL pointers, and arithmetic operations on pointers. It also covers dynamic memory allocation using malloc, calloc, realloc, and free and different approaches to 2D arrays. Finally, it discusses function pointers and their uses, including as callback functions.
The document provides an introduction to the C programming language and algorithms. It begins with an overview of C and its history. It then defines key concepts like keywords, data types, qualifiers, loops, storage classes, decision statements, and jumps. Examples of algorithms are provided for common problems like adding two numbers. Pattern printing algorithms are given as homework exercises. The document discusses where C is used and explains what a programming language and algorithms are. It emphasizes the importance of understanding requirements before implementation.
Team Emertxe explores the C programming language over several days. Day 1 introduces C and discusses its history, characteristics, standard, keywords, typical code structure, compilation process, data representations including numbers, characters, words, integers and floats, basic data types and modifiers, and conditional constructs like if, else if, switch case, for, while, and do while loops. C is presented as a flexible, efficient system programming language used widely in applications like operating systems, embedded systems, and drivers.
Irrespective of devices, C language is the best when it comes to Embedded Systems. This detailed course talks about various finer details of the language.
C has been the most commonly used language. This slideshare is all about the introduction to Advanced C. You will learn the fundamentals and the problem solving skills. You will also get an idea on building algorithms and the conditions regarding it. There are also slides which will give knowledge about operators and their types. As a whole you will gain knowledge on three important fundamentals of C.
Team Emertxe's document provides an overview of functions in C, including:
1. Functions allow code reuse, modularity, and abstraction. They define an activity with inputs, operations, and outputs.
2. Functions are defined with a return type, name, and parameters. They are called by name with arguments. Functions can return values or ignore returned values.
3. Parameters can be passed by value or by reference. Pass by reference allows changing the original argument. Arrays can be passed to functions.
4. Recursive functions call themselves to break down problems. Function pointers allow functions to be called indirectly. Variadic functions accept variable arguments.
5. Common pitfalls include
Facing interviews is both science and an art. Typically for freshers, it becomes very challenging to face interviews. Here is a presentation that gives you practical tips and inputs to crack interviews.
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
This third part of Linux internals talks about Thread programming and using various synchronization mechanisms like mutex and semaphores. These constructs helps users to write efficient programs in Linux environment
Linux is an operating system or a kernel. It is distributed under an open source license. Its functionality list is quite like UNIX. Linux is an operating system or a kernel which germinated as an idea in the mind of young and bright Linus Torvalds when he was a computer science student. The main advantage of Linux was that programmers were able to use the Linux Kernel to design their own custom operating systems. With time, a new range of user-friendly OS's stormed the computer world. Now, Linux is one of the most popular and widely used Kernel, and it is the backbone of popular operating systems like Debian, Knoppix, Ubuntu, and Fedora.
Embedded Systems are basically Single Board Computers (SBCs) with limited and specific functional capabilities. All the components that make up a computer like the Microprocessor, Memory Unit, I/O Unit etc. are hosted on a single board. Their functionality is subject to constraints, and is embedded as a part of the complete device including the hardware, in contrast to the Desktop and Laptop computers which are essentially general purpose (Read more about what is embedded system). The software part of embedded systems used to be vendor specific instruction sets built in as firmware. However, drastic changes have been brought about in the last decade driven by the spurt in technology, and thankfully, the Moore’s Law. New, smaller, smarter, elegant but more powerful and resource hungry devices like Smart-phones, PDAs and cell-phones have forced the vendors to make a decision between hosting System Firmware or full-featured Operating Systems embedded with devices. The choice is often crucial and is decided by parameters like scope, future expansion plans, molecularity, scalability, cost etc. Most of these features being inbuilt into Operating Systems, hosting operating systems more than compensates the slightly higher cost overhead associated with them. Among various Embedded System Operating Systems like VxWorks, pSOS, QNX, Integrity, VRTX, Symbian OS, Windows CE and many other commercial and open-source varieties, Linux has exploded into the computing scene. Owing to its popularity and open source nature, Linux is evolving as an architecturally neutral OS, with reliable support for popular standards and features
Linux has emerged as a number one choice for developing OS based Embedded Systems. Open Source development model, Customizability, Portability, Tool chain availability are some reasons for this success. This course gives a practical perspective of customizing, building and bringing up Linux Kernel on an ARM based target hardware. It combines various previous modules you have learned, by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. After bringing up Linux, you can port any of the existing applications into the target hardware.
This is the last slide of advancedC - Advanced C part 3. In the previous slides we learnt all the fundamentals that is required to learnt Advanced C. In this last slide of Advanced C you will be learning about Multilevel pointers, Command line argument, different kinds of functions, and also you will gain deep knowledge on pre processor and user defined data types. This will help you to improve your knowledge in Advanced C
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
Embedded systems is a special purpose device that does a particular functionality in a most optimized way. Designed as a combination of custom HW & SW, programming Embedded systems require some special considerations to be taken care. Here is a presentation that gives introduction to embedded systems.
Getting started with setting up embedded platform requires audience to understand some of the key aspects of Linux. Starting with basics of Linux this presentation talks about basic commands, vi editor, shell scripting and advanced commands
U-boot provides a multistage boot process that initializes the CPU and board resources incrementally at each stage. It begins execution on the CPU in a limited environment and hands off to subsequent stages that gain access to more resources like memory and devices. U-boot supports booting an operating system image from storage like SSD or over the network and offers features like secure boot and hypervisor support.
This document provides an introduction to key concepts in embedded systems including embedded system components, requirements, trends, common design metrics, development tools, communication protocols like I2C and SPI, and real-time operating systems (RTOS). It defines embedded systems and how they differ from general purpose systems. It also discusses RTOS features like multitasking, task priority, inter-task communication, and how they help achieve real-time capabilities. Key sections of the RTOS are identified including task management, scheduling, synchronization, and interrupt handling.
This is continuation of the slide Advanced C part 1. In part 1 you learnt about fundamentals of C - How to build an algorithm, operators. In this module - Advanced C part 2 you will be learning about functions, pointers and standard Input Output functions. This slide will help you to move a further ahead in Advanced C and gain deeper knowledge on it.
The document summarizes the passes of the GCC compiler from parsing to code generation. It begins with parsing the source code into an AST, followed by converting the AST to GIMPLE intermediate representation and performing optimizations like constant propagation, copy propagation and dead code elimination on the GIMPLE. Control flow graphs are constructed and optimizations are performed with SSA form. RTL is generated from GIMPLE and undergoes register allocation and instruction selection before assembly code generation. Example dumps of different passes are shown.
Often called as the Swiss Army Knife of Embedded Linux, BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. It is written with size-optimization
and limited resources in mind. Here is a presentation that details about BusyBox.
The document provides an overview of principles of programming languages, including:
- Reasons for studying programming language concepts such as improved ability to learn new languages.
- Categories of programming languages including imperative, functional, logic, and object-oriented languages.
- Factors that influence language design such as computer architecture and programming methodologies.
- Methods of describing syntax including Backus-Naur Form and context-free grammars. Attribute grammars add semantic information to parse trees.
- Implementation methods for languages including compilation, interpretation, and hybrid systems.
This document provides an overview of Linux internals and networking concepts covered in 3 sentences or less:
It introduces Linux internals topics like processes, memory management, and virtual file systems. It also discusses networking concepts and provides a brief history of operating systems development. The document contains various sections on Linux components, kernel subsystems, virtual file systems, and transitioning to systems programming.
This document discusses C++11/14 enhancements including data types, literals, attributes, loops, constants, enumerations, typedefs, pointers, smart pointers, references, type inference, functions, and lambda expressions. It provides examples and explanations of new features in each category.
This document provides information about the CS416 Compiler Design course, including the instructor details, prerequisites, textbook, grading breakdown, course outline, and an overview of the major parts and phases of a compiler. The course will cover topics such as lexical analysis, syntax analysis using top-down and bottom-up parsing, semantic analysis using attribute grammars, intermediate code generation, code optimization, and code generation.
The document discusses C preprocessors and user-defined data types in C like structures and unions. It explains that the preprocessor is a program that processes code before compilation. Key preprocessor directives include #include, #define, #ifdef, and #line. Structures allow grouping of different data types while unions allocate space for the largest member. Typedefs create aliases for existing types. Enumerations define sets of named integer constants.
Coming up with optimized C program for Embedded Systems consist of multiple challenges. This presentation talks about various methods about optimizing C programs in Embedded environment. It also has some interesting tips, Do's and Dont's that will offer practical help for an Embedded programmer.
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
This third part of Linux internals talks about Thread programming and using various synchronization mechanisms like mutex and semaphores. These constructs helps users to write efficient programs in Linux environment
Linux is an operating system or a kernel. It is distributed under an open source license. Its functionality list is quite like UNIX. Linux is an operating system or a kernel which germinated as an idea in the mind of young and bright Linus Torvalds when he was a computer science student. The main advantage of Linux was that programmers were able to use the Linux Kernel to design their own custom operating systems. With time, a new range of user-friendly OS's stormed the computer world. Now, Linux is one of the most popular and widely used Kernel, and it is the backbone of popular operating systems like Debian, Knoppix, Ubuntu, and Fedora.
Embedded Systems are basically Single Board Computers (SBCs) with limited and specific functional capabilities. All the components that make up a computer like the Microprocessor, Memory Unit, I/O Unit etc. are hosted on a single board. Their functionality is subject to constraints, and is embedded as a part of the complete device including the hardware, in contrast to the Desktop and Laptop computers which are essentially general purpose (Read more about what is embedded system). The software part of embedded systems used to be vendor specific instruction sets built in as firmware. However, drastic changes have been brought about in the last decade driven by the spurt in technology, and thankfully, the Moore’s Law. New, smaller, smarter, elegant but more powerful and resource hungry devices like Smart-phones, PDAs and cell-phones have forced the vendors to make a decision between hosting System Firmware or full-featured Operating Systems embedded with devices. The choice is often crucial and is decided by parameters like scope, future expansion plans, molecularity, scalability, cost etc. Most of these features being inbuilt into Operating Systems, hosting operating systems more than compensates the slightly higher cost overhead associated with them. Among various Embedded System Operating Systems like VxWorks, pSOS, QNX, Integrity, VRTX, Symbian OS, Windows CE and many other commercial and open-source varieties, Linux has exploded into the computing scene. Owing to its popularity and open source nature, Linux is evolving as an architecturally neutral OS, with reliable support for popular standards and features
Linux has emerged as a number one choice for developing OS based Embedded Systems. Open Source development model, Customizability, Portability, Tool chain availability are some reasons for this success. This course gives a practical perspective of customizing, building and bringing up Linux Kernel on an ARM based target hardware. It combines various previous modules you have learned, by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. After bringing up Linux, you can port any of the existing applications into the target hardware.
This is the last slide of advancedC - Advanced C part 3. In the previous slides we learnt all the fundamentals that is required to learnt Advanced C. In this last slide of Advanced C you will be learning about Multilevel pointers, Command line argument, different kinds of functions, and also you will gain deep knowledge on pre processor and user defined data types. This will help you to improve your knowledge in Advanced C
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
Embedded systems is a special purpose device that does a particular functionality in a most optimized way. Designed as a combination of custom HW & SW, programming Embedded systems require some special considerations to be taken care. Here is a presentation that gives introduction to embedded systems.
Getting started with setting up embedded platform requires audience to understand some of the key aspects of Linux. Starting with basics of Linux this presentation talks about basic commands, vi editor, shell scripting and advanced commands
U-boot provides a multistage boot process that initializes the CPU and board resources incrementally at each stage. It begins execution on the CPU in a limited environment and hands off to subsequent stages that gain access to more resources like memory and devices. U-boot supports booting an operating system image from storage like SSD or over the network and offers features like secure boot and hypervisor support.
This document provides an introduction to key concepts in embedded systems including embedded system components, requirements, trends, common design metrics, development tools, communication protocols like I2C and SPI, and real-time operating systems (RTOS). It defines embedded systems and how they differ from general purpose systems. It also discusses RTOS features like multitasking, task priority, inter-task communication, and how they help achieve real-time capabilities. Key sections of the RTOS are identified including task management, scheduling, synchronization, and interrupt handling.
This is continuation of the slide Advanced C part 1. In part 1 you learnt about fundamentals of C - How to build an algorithm, operators. In this module - Advanced C part 2 you will be learning about functions, pointers and standard Input Output functions. This slide will help you to move a further ahead in Advanced C and gain deeper knowledge on it.
The document summarizes the passes of the GCC compiler from parsing to code generation. It begins with parsing the source code into an AST, followed by converting the AST to GIMPLE intermediate representation and performing optimizations like constant propagation, copy propagation and dead code elimination on the GIMPLE. Control flow graphs are constructed and optimizations are performed with SSA form. RTL is generated from GIMPLE and undergoes register allocation and instruction selection before assembly code generation. Example dumps of different passes are shown.
Often called as the Swiss Army Knife of Embedded Linux, BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. It is written with size-optimization
and limited resources in mind. Here is a presentation that details about BusyBox.
The document provides an overview of principles of programming languages, including:
- Reasons for studying programming language concepts such as improved ability to learn new languages.
- Categories of programming languages including imperative, functional, logic, and object-oriented languages.
- Factors that influence language design such as computer architecture and programming methodologies.
- Methods of describing syntax including Backus-Naur Form and context-free grammars. Attribute grammars add semantic information to parse trees.
- Implementation methods for languages including compilation, interpretation, and hybrid systems.
This document provides an overview of Linux internals and networking concepts covered in 3 sentences or less:
It introduces Linux internals topics like processes, memory management, and virtual file systems. It also discusses networking concepts and provides a brief history of operating systems development. The document contains various sections on Linux components, kernel subsystems, virtual file systems, and transitioning to systems programming.
This document discusses C++11/14 enhancements including data types, literals, attributes, loops, constants, enumerations, typedefs, pointers, smart pointers, references, type inference, functions, and lambda expressions. It provides examples and explanations of new features in each category.
This document provides information about the CS416 Compiler Design course, including the instructor details, prerequisites, textbook, grading breakdown, course outline, and an overview of the major parts and phases of a compiler. The course will cover topics such as lexical analysis, syntax analysis using top-down and bottom-up parsing, semantic analysis using attribute grammars, intermediate code generation, code optimization, and code generation.
The document discusses C preprocessors and user-defined data types in C like structures and unions. It explains that the preprocessor is a program that processes code before compilation. Key preprocessor directives include #include, #define, #ifdef, and #line. Structures allow grouping of different data types while unions allocate space for the largest member. Typedefs create aliases for existing types. Enumerations define sets of named integer constants.
Coming up with optimized C program for Embedded Systems consist of multiple challenges. This presentation talks about various methods about optimizing C programs in Embedded environment. It also has some interesting tips, Do's and Dont's that will offer practical help for an Embedded programmer.
In order to understand HAL layers of Android Framework, having Linux device driver knowledge is important. Hence Day-2 of the workshop focuses on the same.
Communication protocols (like UART, SPI, I2C) play an very important role in Micro-controlled based embedded systems development. These protocols helps the main board to communicate with different peripherals by interfacing mechanism. Here is a presentation that talks about how these protocols actually work.
Data Structures, which is also called as Abstract Data Types (ADT) provide powerful options for programmer. Here is a tutorial which talks about various ADTs - Linked Lists, Stacks, Queues and Sorting Algorithms
This document provides an introduction to AVR microcontrollers. It discusses the history of microcontrollers beginning in 1971 and components like CPU, ROM, RAM and I/O. AVR microcontrollers were introduced in 1996 and range from 1 to 256KB with 8 to 100 pins. They are cheaper and slower than microprocessors but are useful for specialized applications. The document outlines the AVR architecture and family as well as development tools and support for AVR microcontrollers.
For new age touch-based embedded devices, Android is becoming a popular OS going beyond mobile phones. With its roots from Embedded Linux, Android framework offers benefits in terms of rich libraries, open-source and multi-device support. Emertxe’s hands-on Embedded Android Training Course is designed to customize, build and deploy custom Embedded OS on ARM target. Rich set of projects will make your learning complete.
Embedded Android system development workshop is focused on integrating new device with Android framework. Our hands-on approach makes Emertxe as the best institute to learn android system development training. This workshop deep dives into Android porting, Android Hardware Abstraction Layer (HAL), Android Services and Linux device driver ecosystem. This workshop based training program will enable you to efficiently integrate new hardware with Android HAL / Framework.
There is a surge in number of sensors / devices that are getting connected under the umbrella of Internet-Of-Things (IoT). These devices need to be integrated into the Android system and accessed via applications, which is covered in the course. Our Android system development course curriculum over weekends with practicals ensures you learn all critical components to get started.
This course gets you started with writing device drivers in Linux by providing real time hardware exposure. Equip you with real-time tools, debugging techniques and industry usage in a hands-on manner. Dedicated hardware by Emertxe's device driver learning kit. Special focus on character and USB device drivers.
This document provides an overview of the C programming language and includes 97 C programming problems and their solutions. It begins with the basics of C including history, why C is used, data types, operators, control structures, functions, arrays, pointers, structures and file handling. It then lists 97 programming problems covering simple programs, conditional statements, loops, strings, arrays, structures, functions, pointers and file handling. The problems increase in complexity and cover most fundamental concepts of C programming.
The document discusses different types of loops in C programming: for loops, while loops, and do-while loops. For loops allow initialization of a variable, specify a condition, and how to increment the variable. While loops repeatedly execute code as long as a condition is true. Do-while loops are similar but check the condition at the bottom of the loop, so the code executes at least once. Examples of each loop type are provided.
This document provides an overview of embedded systems topics including:
1. It outlines an agenda to cover embedded system basics, processors and architectures, serial communication, real-time operating systems, and embedded programming demos.
2. It defines embedded systems as systems with dedicated software embedded in hardware to perform specific tasks as part of a larger system.
3. It discusses different processor types including microprocessors, microcontrollers, digital signal processors, and application specific integrated processors.
Embedded c programming guide e book atmel 8051 / 89c51 /89c52Raghav Shetty
The document appears to be a long string of repeating binary digits (010101010101...) with no other meaningful information. It consists entirely of binary numbers with no spaces or punctuation.
This document discusses embedded C and provides examples of control structures and algorithms used in embedded systems. It describes embedded C as a subset of C that is compatible with microcontrollers and excludes input/output functions. The development process involves writing C programs in AVR Studio, compiling to a hex file, simulating, and programming the microcontroller chip. Examples are provided for if-statements, do-while loops, for loops, and algorithms like blinking an LED. The document also demonstrates creating an AVR project in AVR Studio, coding, building, running, and burning the hex file onto the microcontroller.
The document discusses algorithms, pseudocode, and flowcharts. It defines an algorithm as a set of precise, unambiguous steps to accomplish a task. Pseudocode uses plain language to represent program logic and includes structures like sequence, selection, and iteration. A flowchart visually depicts a program's flow using standard symbols like rectangles, diamonds, and arrows. It provides examples of algorithms, pseudocode, and a basic payroll calculation flowchart.
Emertxe Certified Embedded Professional (ECEP) is a flagship program from Emertxe. This presentation talks about our continuous and holistic evaluation system that makes a student industry/job ready.
The document discusses various topics related to embedded C programming including differences between operating systems and embedded systems, advantages of using C for embedded programming, differences between conventional C and embedded C, and tools used for embedded C development. Key points include: Embedded systems are closely tied to hardware and have limited memory and registers compared to operating systems. C is commonly used for embedded programming due to its familiarity, reliability, and portability. Embedded C requires a cross compiler to generate object code for the target microcontroller.
BeagleBone Black is one of the most popular open hardware that is available to learn Embedded Linux. This versatile platform helps you to explore different set of peripherals and helps you to load a custom Embedded distribution. This presentation briefly introduces you with BeagleBone Black.
C is a general-purpose programming language developed in the 1970s. It produces very fast executable code and is widely used for operating systems, compilers, and many other applications. Some key reasons for its popularity include its portability, ability to access hardware directly, and large existing code base. The document provides an overview of C's history, why it is still useful today, basic C program structure, and other programming concepts like tokens, keywords, identifiers, and constants.
This document provides an introduction to the C programming language. It discusses that C is a procedural language initially developed by Dennis Ritchie in 1972 primarily for system programming like operating system development. It describes the main features of C like low-level access to memory and simple keywords. Many other languages like Java and JavaScript have borrowed syntax from C. The document then discusses the history of C's development at Bell Labs and its general program structure. It provides an example C program to calculate the area of a circle and explains each section of the code. Finally, it covers various C programming concepts like header files, character set, tokens, constants, variables and data types.
The document provides an overview of C programming, including:
1. C is an intermediate-level language developed in 1972 by Dennis Ritchie at Bell Labs. It combines high-level and low-level language features.
2. The document discusses C character sets, identifiers, keywords, variables, constants, data types, and basic C program structure.
3. It also covers compiling and linking C programs, as well as basic operators, decision making statements, and loops in C.
C is the building block for many other programming languages. Programs written in C are highly portable. Several standard functions are there (like in-built) that can be used to develop programs. C programs are collections of C library functions, and it's also easy to add functions to the C library.
The document provides an overview of C programming for a computer science course. It discusses:
- The history and development of the C language.
- Key features of C including its popularity, efficiency, portability, and ability to interface with other languages.
- Characteristics of C such as it being a general purpose, structured, and portable programming language.
- Components of a C program including main functions, data types, keywords, operators, variables, and control statements like if/else, switch, and loops.
The document provides information about a C programming module including:
- It is a 15 credit module comprising 50 hours of lectures and 50 hours of self-study.
- Assessment includes a CAT worth 60 marks and a final exam worth 40 marks.
- The module aims to teach students how to write and debug C programs, structured program design, and use C language constructs to solve problems in various areas.
C Programming
History of C Programming
Features of C Programming
More about C Programming
Advantages of C Programming
Disadvantages of C Programming
Write using C programming
This document provides an introduction to programming languages. It discusses the different generations of programming languages from machine language to natural languages. Machine language is the lowest level and most difficult for humans, while higher level languages like C++ and Java are easier for programmers but require compilers. The document then focuses on C language, explaining its history, uses, data types, variables, constants, operators and I/O functions. It provides examples of declaring variables and using format specifiers in C.
This document outlines the objectives and key topics for an introduction to the C programming language. It will cover writing a basic "Hello World" program, understanding C program structure with blocks and comments, using basic data types like integers and characters, declaring and initializing variables, and input/output concepts. The document introduces C as a structured, high-level language and discusses identifiers, constants, and basic data types before explaining how to write a first program in C.
Introduction_to_c_programming.ppt for software developing studentsAsfiya14
C is a powerful and versatile programming language that was developed in the early 1970s by Dennis Ritchie at Bell Labs. It was designed to be a system programming language for Unix operating systems but quickly gained popularity due to its efficiency, flexibility, and portability. C has since become one of the most widely used programming languages and forms the basis for many other languages like C++, Java, and Python.
This document outlines the objectives and key topics for an introduction to the C programming language. It will cover writing a basic "Hello World" program, understanding C program structure with blocks and comments, using basic data types like integers and characters, declaring and initializing variables, and input/output concepts. The document introduces C as a structured, high-level language and discusses identifiers, constants, and basic data types before explaining how to write a first program in C.
The document discusses various topics related to the C programming language including low-level languages, data types, operators, expressions, and control flow statements. It begins by explaining machine language, assembly language, and high-level languages. It then covers basic data types in C like integer, floating-point, character, and string constants. Various categories of operators used in C expressions are defined along with examples. Control flow statements like if-else, while, for, break and continue are also introduced.
Lect 1. introduction to programming languagesVarun Garg
A programming language is a set of rules that allows humans to communicate instructions to computers. There are many programming languages because they have evolved over time as better ways to design them have been developed. Programming languages can be categorized based on their generation or programming paradigm such as imperative, object-oriented, logic-based, and functional. Characteristics like writability, readability, reliability and maintainability are important qualities for programming languages.
A beginner level programming event where you will take your first steps with the basic concepts of C. You will have skill checks in between, in the form of quizzes and you will also get hands-on exposure in this field.
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.
This document provides an overview of the C programming language. It discusses low-level languages like machine code and assembly language. It then covers the C language topics like data types, variables, constants, operators, decision making, looping, and functions. It provides details on each of these concepts and gives examples. The document also discusses the history of C and its characteristics as a structured, portable programming language suitable for system and application programming.
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.
The document discusses implementing a function to check if a character is a hexadecimal digit. It explains that a hexadecimal digit ranges from 0-9, A-F, a-f in the ASCII table. It provides examples of inputting different characters and checking if they are hexadecimal digits or not. The sample execution section is empty. It lists functions as the prerequisite for understanding how to create a custom function to check for hexadecimal digits.
The document provides an example program to implement a student record system using an array of structures. It involves reading the number of students and subjects, student names and marks for each subject, calculating averages and grades. The program displays menus to view all student details or a particular student's details based on roll number or name. It demonstrates declaring a structure for student records, reading input into an array of structures, calculating averages and grades, and printing the student records with options to search by roll number or name.
This document discusses writing a macro called swap(t,x,y) that swaps two arguments of any data type t. It asks the user to input a data type and two values of that type, then swaps the values and displays the output. It explains how to swap two integers by using a temporary variable and applying the same concept to arguments of any type t by using macros. The objective is to understand macro preprocessing in C.
This document discusses defining a macro called SIZEOF to return the size of a data type without using the sizeof operator. It explains that by taking the difference of the addresses of a variable and the variable plus one, cast to char pointers, you can get the size in bytes. An example is provided using an integer variable x, showing how taking the difference of (&x+1) and &x after casting to char pointers returns the size of an int, which is 4 bytes. Background on macros and pointers is provided. The objective is stated as understanding macro usage in preprocessing.
The document describes a C program to multiply two matrices. It explains that the program takes input of rows and columns for Matrix A and B, reads in the element values, and checks that the column of the first matrix equals the row of the second before calculating the product. An example is provided where the matrices can be multiplied, producing the output matrix, and another where they cannot due to mismatched dimensions. Requirements for the program include pointers, 2D arrays, and dynamic memory allocation.
The document describes an assignment to read in an unspecified number (n) of names of up to 20 characters each, sort the names alphabetically, and print the sorted list. It provides examples of reading in 3 names ("Arunachal", "Bengaluru", "Agra"), sorting them using a custom string comparison function, and printing the sorted list ("Agra", "Arunachal", "Bengaluru"). Pre-requisites for the assignment include functions, dynamic arrays, and pointers. The objective is to understand how to use functions, arrays and pointers to complete the task.
This document provides instructions for an assignment to implement fragments using an array of pointers. It asks the student to write a program that reads the number of rows and columns for each row, reads the elements for each row, calculates the average for each row, sorts the rows based on average, and prints the results. It includes examples that show reading input values, storing them in an array using pointers, calculating averages, sorting rows, and sample output. The prerequisites are listed as pointers, functions, and dynamic memory allocation, and the objective is stated as understanding dynamic memory allocation and arrays of pointers.
The document describes an algorithm to generate a magic square of size n×n. It takes the integer n as input from the user and outputs the n×n magic square. A magic square is an arrangement of distinct numbers in a square grid where the sum of each row, column and diagonal is equal. The algorithm uses steps like starting from the middle of the grid and moving element by element in a pattern, wrapping around when reaching the boundaries.
This document discusses endianness and provides an example program to convert between little endian and big endian formats. It defines endianness as the order of bytes in memory, and describes little endian as having the least significant byte at the lowest memory address and big endian as the opposite. An example shows inputting a 2-byte number in little endian format and outputting it in big endian. Pre-requisites of pointers and the objective of understanding endianness representations are also stated.
The document provides steps to calculate variance of an array using dynamic memory allocation in C. It explains what variance is, shows an example to calculate variance of a sample array by finding the mean, deviations from mean, squaring the deviations and calculating the average of squared deviations. The key steps are: 1) Read array size and elements, 2) Calculate mean, 3) Find deviations from mean, 4) Square the deviations and store in another array, 5) Calculate average of squared deviations to get variance.
This document provides examples for an assignment to create a menu-driven program that stores and manipulates different data types (char, int, float, double) in dynamically allocated memory. It allocates 8 consecutive bytes to store the variables and uses flags to track which data types are stored. The menu allows the user to add, display, and remove elements as well as exit the program. Examples demonstrate initializing the flags, adding/removing elements, updating the flags, and displaying only elements whose flags are set. The objective is to understand dynamic memory allocation using pointers.
The document discusses generating non-repetitive pattern strings (NRPS) of length n using k distinct characters. It explains that an NRPS has a pattern that is not repeated consecutively. It provides steps to check if a string is an NRPS, including comparing characters and resetting a count if characters do not match. It also describes how to create an NRPS by starting with an ordered pattern and then copying subsequent characters to generate new patterns without repetition until the string reaches the desired length n. Sample inputs and outputs are provided.
The document discusses how to check if a string is a pangram, which is a sentence containing all 26 letters of the English alphabet. It provides an example of implementing the algorithm to check for a pangram by initializing an array to track letter occurrences, iterating through the input string to mark letters in the array, and checking if all letters are marked to determine if it is a pangram.
The document explains how to print all possible combinations of a given string by swapping characters. It provides an example of generating all six combinations of the string "ABC" through a step-by-step process of swapping characters. It also lists the prerequisites as strings, arrays, and pointers and the objective as understanding string manipulations.
The document describes an assignment to write a program that squeezes characters from one string (s1) that match characters in a second string (s2). It provides examples of input/output and step-by-step demonstrations of the program removing matching characters from s1. It also lists prerequisites of functions, arrays, and pointers and the objective of understanding these concepts as they relate to strings.
The document discusses implementing the strtok() string tokenization function. It explains that strtok() breaks a string into tokens based on delimiters. The document then provides pseudocode to implement a custom strtok() function by iterating through the string, overwriting delimiter characters with null terminators to create tokens, and returning a pointer to each token. Sample input/output is provided. The objective is stated as understanding string functions, with prerequisites of strings, storage classes, and pointers.
The document provides details on an assignment to write a program that recursively reverses a given string without using static variables, global variables, or loops. It includes the input, output, and examples of reversing the strings "Extreme" and "hello world". It also provides sample execution and pre-requisites of strings and recursive functions, with the objective being to understand reversing a string recursively.
The document provides code and examples for reversing a string using an iterative method in C++. It explains taking in a string as input, declaring output and input strings of the same length, and swapping the first and last characters, second and second to last, and so on through multiple iterations until the string is reversed. Examples show reversing the strings "Extreme" to "emertxE" and "hello world" to "dlrow olleh" through this iterative swap process. Pre-requisites of strings and loops are noted, with the objective stated as understanding string reversal using an iterative approach.
What is Model Context Protocol(MCP) - The new technology for communication bw...Vishnu Singh Chundawat
The MCP (Model Context Protocol) is a framework designed to manage context and interaction within complex systems. This SlideShare presentation will provide a detailed overview of the MCP Model, its applications, and how it plays a crucial role in improving communication and decision-making in distributed systems. We will explore the key concepts behind the protocol, including the importance of context, data management, and how this model enhances system adaptability and responsiveness. Ideal for software developers, system architects, and IT professionals, this presentation will offer valuable insights into how the MCP Model can streamline workflows, improve efficiency, and create more intuitive systems for a wide range of use cases.
Quantum Computing Quick Research Guide by Arthur MorganArthur Morgan
This is a Quick Research Guide (QRG).
QRGs include the following:
- A brief, high-level overview of the QRG topic.
- A milestone timeline for the QRG topic.
- Links to various free online resource materials to provide a deeper dive into the QRG topic.
- Conclusion and a recommendation for at least two books available in the SJPL system on the QRG topic.
QRGs planned for the series:
- Artificial Intelligence QRG
- Quantum Computing QRG
- Big Data Analytics QRG
- Spacecraft Guidance, Navigation & Control QRG (coming 2026)
- UK Home Computing & The Birth of ARM QRG (coming 2027)
Any questions or comments?
- Please contact Arthur Morgan at [email protected].
100% human made.
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersToradex
Toradex brings robust Linux support to SMARC (Smart Mobility Architecture), ensuring high performance and long-term reliability for embedded applications. Here’s how:
• Optimized Torizon OS & Yocto Support – Toradex provides Torizon OS, a Debian-based easy-to-use platform, and Yocto BSPs for customized Linux images on SMARC modules.
• Seamless Integration with i.MX 8M Plus and i.MX 95 – Toradex SMARC solutions leverage NXP’s i.MX 8 M Plus and i.MX 95 SoCs, delivering power efficiency and AI-ready performance.
• Secure and Reliable – With Secure Boot, over-the-air (OTA) updates, and LTS kernel support, Toradex ensures industrial-grade security and longevity.
• Containerized Workflows for AI & IoT – Support for Docker, ROS, and real-time Linux enables scalable AI, ML, and IoT applications.
• Strong Ecosystem & Developer Support – Toradex offers comprehensive documentation, developer tools, and dedicated support, accelerating time-to-market.
With Toradex’s Linux support for SMARC, developers get a scalable, secure, and high-performance solution for industrial, medical, and AI-driven applications.
Do you have a specific project or application in mind where you're considering SMARC? We can help with Free Compatibility Check and help you with quick time-to-market
For more information: https://www.toradex.com/computer-on-modules/smarc-arm-family
Dev Dives: Automate and orchestrate your processes with UiPath MaestroUiPathCommunity
This session is designed to equip developers with the skills needed to build mission-critical, end-to-end processes that seamlessly orchestrate agents, people, and robots.
📕 Here's what you can expect:
- Modeling: Build end-to-end processes using BPMN.
- Implementing: Integrate agentic tasks, RPA, APIs, and advanced decisioning into processes.
- Operating: Control process instances with rewind, replay, pause, and stop functions.
- Monitoring: Use dashboards and embedded analytics for real-time insights into process instances.
This webinar is a must-attend for developers looking to enhance their agentic automation skills and orchestrate robust, mission-critical processes.
👨🏫 Speaker:
Andrei Vintila, Principal Product Manager @UiPath
This session streamed live on April 29, 2025, 16:00 CET.
Check out all our upcoming Dev Dives sessions at https://community.uipath.com/dev-dives-automation-developer-2025/.
This is the keynote of the Into the Box conference, highlighting the release of the BoxLang JVM language, its key enhancements, and its vision for the future.
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungenpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-nomad-web-best-practices-und-verwaltung-von-multiuser-umgebungen/
HCL Nomad Web wird als die nächste Generation des HCL Notes-Clients gefeiert und bietet zahlreiche Vorteile, wie die Beseitigung des Bedarfs an Paketierung, Verteilung und Installation. Nomad Web-Client-Updates werden “automatisch” im Hintergrund installiert, was den administrativen Aufwand im Vergleich zu traditionellen HCL Notes-Clients erheblich reduziert. Allerdings stellt die Fehlerbehebung in Nomad Web im Vergleich zum Notes-Client einzigartige Herausforderungen dar.
Begleiten Sie Christoph und Marc, während sie demonstrieren, wie der Fehlerbehebungsprozess in HCL Nomad Web vereinfacht werden kann, um eine reibungslose und effiziente Benutzererfahrung zu gewährleisten.
In diesem Webinar werden wir effektive Strategien zur Diagnose und Lösung häufiger Probleme in HCL Nomad Web untersuchen, einschließlich
- Zugriff auf die Konsole
- Auffinden und Interpretieren von Protokolldateien
- Zugriff auf den Datenordner im Cache des Browsers (unter Verwendung von OPFS)
- Verständnis der Unterschiede zwischen Einzel- und Mehrbenutzerszenarien
- Nutzung der Client Clocking-Funktion
Mobile App Development Company in Saudi ArabiaSteve Jonas
EmizenTech is a globally recognized software development company, proudly serving businesses since 2013. With over 11+ years of industry experience and a team of 200+ skilled professionals, we have successfully delivered 1200+ projects across various sectors. As a leading Mobile App Development Company In Saudi Arabia we offer end-to-end solutions for iOS, Android, and cross-platform applications. Our apps are known for their user-friendly interfaces, scalability, high performance, and strong security features. We tailor each mobile application to meet the unique needs of different industries, ensuring a seamless user experience. EmizenTech is committed to turning your vision into a powerful digital product that drives growth, innovation, and long-term success in the competitive mobile landscape of Saudi Arabia.
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfAbi john
Analyze the growth of meme coins from mere online jokes to potential assets in the digital economy. Explore the community, culture, and utility as they elevate themselves to a new era in cryptocurrency.
AI and Data Privacy in 2025: Global TrendsInData Labs
In this infographic, we explore how businesses can implement effective governance frameworks to address AI data privacy. Understanding it is crucial for developing effective strategies that ensure compliance, safeguard customer trust, and leverage AI responsibly. Equip yourself with insights that can drive informed decision-making and position your organization for success in the future of data privacy.
This infographic contains:
-AI and data privacy: Key findings
-Statistics on AI data privacy in the today’s world
-Tips on how to overcome data privacy challenges
-Benefits of AI data security investments.
Keep up-to-date on how AI is reshaping privacy standards and what this entails for both individuals and organizations.
How Can I use the AI Hype in my Business Context?Daniel Lehner
𝙄𝙨 𝘼𝙄 𝙟𝙪𝙨𝙩 𝙝𝙮𝙥𝙚? 𝙊𝙧 𝙞𝙨 𝙞𝙩 𝙩𝙝𝙚 𝙜𝙖𝙢𝙚 𝙘𝙝𝙖𝙣𝙜𝙚𝙧 𝙮𝙤𝙪𝙧 𝙗𝙪𝙨𝙞𝙣𝙚𝙨𝙨 𝙣𝙚𝙚𝙙𝙨?
Everyone’s talking about AI but is anyone really using it to create real value?
Most companies want to leverage AI. Few know 𝗵𝗼𝘄.
✅ What exactly should you ask to find real AI opportunities?
✅ Which AI techniques actually fit your business?
✅ Is your data even ready for AI?
If you’re not sure, you’re not alone. This is a condensed version of the slides I presented at a Linkedin webinar for Tecnovy on 28.04.2025.
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul
Artificial intelligence is changing how businesses operate. Companies are using AI agents to automate tasks, reduce time spent on repetitive work, and focus more on high-value activities. Noah Loul, an AI strategist and entrepreneur, has helped dozens of companies streamline their operations using smart automation. He believes AI agents aren't just tools—they're workers that take on repeatable tasks so your human team can focus on what matters. If you want to reduce time waste and increase output, AI agents are the next move.
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPathCommunity
Join this UiPath Community Berlin meetup to explore the Orchestrator API, Swagger interface, and the Test Manager API. Learn how to leverage these tools to streamline automation, enhance testing, and integrate more efficiently with UiPath. Perfect for developers, testers, and automation enthusiasts!
📕 Agenda
Welcome & Introductions
Orchestrator API Overview
Exploring the Swagger Interface
Test Manager API Highlights
Streamlining Automation & Testing with APIs (Demo)
Q&A and Open Discussion
Perfect for developers, testers, and automation enthusiasts!
👉 Join our UiPath Community Berlin chapter: https://community.uipath.com/berlin/
This session streamed live on April 29, 2025, 18:00 CET.
Check out all our upcoming UiPath Community sessions at https://community.uipath.com/events/.
Role of Data Annotation Services in AI-Powered ManufacturingAndrew Leo
From predictive maintenance to robotic automation, AI is driving the future of manufacturing. But without high-quality annotated data, even the smartest models fall short.
Discover how data annotation services are powering accuracy, safety, and efficiency in AI-driven manufacturing systems.
Precision in data labeling = Precision on the production floor.
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Impelsys Inc.
Impelsys provided a robust testing solution, leveraging a risk-based and requirement-mapped approach to validate ICU Connect and CritiXpert. A well-defined test suite was developed to assess data communication, clinical data collection, transformation, and visualization across integrated devices.
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxAnoop Ashok
In today's fast-paced retail environment, efficiency is key. Every minute counts, and every penny matters. One tool that can significantly boost your store's efficiency is a well-executed planogram. These visual merchandising blueprints not only enhance store layouts but also save time and money in the process.
3. Goals & Objectives
● To cover the depth of the C language from its core.
● To cover all the functionalities of the language, more important
from the industry perspective.
● By the end, students are expected to have made their concepts
very clear and become comfortable using the language to any level.
● Mastering the basics, Playing with all kinds of Pointers, Var Args,
Recursions, Functions, Files, Preprocessor Directives, and many
other industry relevant topics.
● As an overall experience, it will take you through all the nitty-
gritties of C through a well organized set of examples and exercises
4. ToC
● Introduction
● Brief History
● Programming languages
● The C standard
● Important Characteristics
● Keywords
6. Language
● Simply put, a language is a stylized communication technique.
● The more varied vocabulary it has, the more expressive it
becomes. Then, there is grammar to make meaningful
communication statements out of it.
● Similarly, being more specific, a programming language is a stylized
communication technique intended to be used for controlling the
behavior of a machine (often a computer),by expressing ourselves
to the machine.
● Like the natural languages, programming languages too, have
syntactic rules (to form words) and semantic rules (to form
sentences), used to define the meaning.
8. Brief History
● Prior to C, most of the computer languages (such as Algol) were
academic oriented, unrealistic and were generally defined by
committees.
● Since such languages were designed having application domain in
mind, they could not take the advantages of the underlying
hardware and if done, were not portable or efficient under other
systems.
● It was thought that a high-level language could never achieve the
efficiency of assembly language.
Portable, efficient and easy to use language was a dream.
9. Brief History ...
● It was a revolutionary language and shook the computer world with
its might. With just 32 keywords, C established itself in a very wide
base of applications.
● It has lineage starting from CPL, (Combined Programming Language)
a never implemented language.
● Martin Richards implemented BCPL as a modified version of CPL.
Ken Thompson further refined BCPL to a language named as B.
● Later Dennis M. Ritchie added types to B and created a language,
what we have as C, for rewriting the UNIX operating system.
10. Programming languages
● There are various types of programming languages, compared on various parameters
● From Embedded system engineer’s view it should be seen how close or how much away from the hardware the
language is
● Based on that view programming languages can be categorized into three areas:
Assembly language (ex: 8051)
Middle level language (ex: C)
High level / Scripting language (ex: Shell)
● Each programming language offers some benefits with some shortcomings
● Depending on the need of the situation appropriate language needs to be chosen
● This make language selection is a key criteria when it comes to building real time products!
11. A comparison
Language parameter Assembly C Shell
Speed High Medium Medium
Portability Low Medium High
Maintainability Low Medium High
Size High Medium Low
Easy to learn Low Medium High
Shell or any scripting language is also called as ‘interpreted’ language as it
doesn’t go thru compilation phase. This is to keep the language simple as
the purpose is different than other languages.
12. The C Standard
● “The C programming language” book served as a
primary reference for C programmers and
implementers alike for nearly a decade.
● However it didn’t define C perfectly and there were
many ambiguous parts in the language.
● As far as the library was concerned, only the C
implementation in UNIX was close to the ’standard’.
● So many dialects existed for C and it was the time the language has to be
standardized and it was done in 1989 with ANSI C standard.
● Nearly after a decade another standard, C9X, for C is available that provides many
significant improvements over the previous 1989 ANSI C standard.
13. Important
Characteristics
● C is considered as a middle level language.
● C can be considered as a pragmatic language.
● It is indented to be used by advanced programmers, for serious use, and
not for novices and thus qualify less as an academic language for learning.
● Gives importance to curt code.
● It is widely available in various platforms from mainframes to palmtops and
is known for its wide availability.
14. Important
Characteristics...
● It is a general-purpose language, even though it is applied and used
effectively in various specific domains.
● It is a free-formatted language (and not a strongly-typed language)
● Efficiency and portability are the important considerations.
● Library facilities play an important role
15. Keyword
● In programming, a keyword is a word that is reserved by a
program because the word has a special meaning
● Keywords can be commands or parameters
● Every programming language has a set of keywords that cannot be
used as variable names
● Keywords are sometimes called reserved names
16. Keywords ...
● auto
● break
● case
● char
● const
● continue
● default
● do
● double
● else
● enum
● extern
● float
● for
● if
● int
● long
● register
● return
● short
● signed
● sizeof
● static
● struct
● switch
● typedef
● union
● unsigned
● void
● volatile
● while
● goto
20. Data representation
● Why bits?
● Representing information as bits
● Binary/Hexadecimal
● Byte representations
● ANSI data storage
● Embedded specific data storage
● Floating point representation
21. Base 2
● Base 2 Number Representation
● Electronic Implementation
● Easy to store
● Reliably transmitted on noisy and inaccurate wires
● Straightforward implementation of arithmetic
functions
23. Base 2
Integer Representation
●
Negative numbers representation:
Negative numbers are represented by 2's complement .
Below example shows how (-13) 10
are converted to binary form and stored in the 32 – bit
machine.
STEPS:
Step1: Convert ( 13 )10
to binary equivalent.
( 13 )10
= ( 0000 0000 0000 0000 0000 0000 0000 1101 )2
Step2: Take 1's complement of binary equivalent.( i.e converting all 1's to 0's &
all 0's to 1's)
( 1111 1111 1111 1111 1111 1111 1111 0010 )2
25. Byte Encoding
● 1Nibble = 4 bits
● 1Byte = 8 bits
● Binary : 000000002
- 111111112
● Decimal : 010
- 25510
● Octal : 08
- 3778
● Hexadecimal: 0016
- FF16
● Base 16 number representation
● Use characters ‘0’ to ‘9’ and ‘A’ to ‘F’
● Write FA1D37B16
in C as 0xFA1D37B
Hex Dec Bin
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
26. Byte Encoding
Quiz
1. Convert 103 from decimal to base 2
2. Convert 1011 0110 0011 from binary to hexadecimal
3. Convert 240 from hexadecimal to binary
4. Convert 011 111 111 from binary to base 8
5. Convert 14 from base 8 to binary
27. Byte ordering
Example:
● Variable x has 2-byte representation D7C4
Machine Type Ordering of Bytes Examples
Big Endian Least significant byte has
Highest address
Sun, Mac
Little Endian Least significant byte has
lowest address
Alphas
30. Sizes :
Basic Data Types
● Type int is supposed to represent a machine's natural word size
● The size of character is always 1 byte
● 1 byte = sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
<= sizeof(long long)
● float = 4 bytes
● double = 8 bytes
● pointer = address word, mostly same as word
31. Sizes :
Basic Data Types
● In C sizes of datatypes are not Fixed
OS 32-Bit 64-Bit
Windows LP32 LLP64
Linux LP32 LP64
32. Basic Data Types:
char
● Smallest addressable unit of the machine that can contain basic
character set.
● It is an integer type.
● Actual type can be either signed or unsigned depending on the
implementation.
● Example:
● char ch = 'a';
● char ch = 97;
Think
char ch = 'a' + 10 is possible?
33. Basic Data Types:
char
● Different ways of reading / scanning the character
Function Example
scanf scanf(“%c”, &ch);
getchar ch = getchar();
getc ch = getc(stdin);
fgetc ch = fgetc(stdin);
34. Basic Data Types:
int
● The most basic and commonly used integral type.
● Format specifiers for ints are either %d or %i, for either printf or
scanf.
● Example:
● int i = 100;
35. Real Numbers:
Representation
IEEE float: 32 bits 1 bit for the sign, 8 bits for the exponent, and 23 bits
for the mantissa. Also called single precision.
IEEE double: 64 bits 1 bit for the sign, 11 bits for the exponent, and 52 bits
for the mantissa. Also called double precision.
sign Exponent mantissa
Float ( 32 bits ) 1 bit 8 bits 23 bits
Double ( 64 bits ) 1 bit 11 bits 52 bits
36. Float to binary
Conversion Procedure
STEP 1: Convert the absolute value of the number to binary, perhaps with a
fractional part after the binary point. This can be done by converting the integral
and fractional parts separately. The integral part is converted with the techniques
examined previously. The fractional part can be converted by multiplication.
STEP 2: Append × (2 ^ 0) to the end of the binary number (which does not change
its value).
STEP 3: Normalize the number. Move the binary point so that it is one bit from the
left. Adjust the exponent of two so that the value does not change.
37. Float to binary
Conversion Procedure
STEP 4: Place the mantissa into the mantissa field of the number. Omit the leading
one, and fill with zeros on the right.
STEP 5: Add the bias to the exponent of two, and place it in the exponent field.
The bias is 2 ^ (k−1)−1, where k is the number of bits in the exponent field. For the
eight-bit format, k = 3, so the bias is 2 ^ (3−1) − 1 = 3. For IEEE 32-bit, k = 8, so the
bias is 2^( 8−1) − 1 = 127.
STEP 6: Set the sign bit, 1 for negative, 0 for positive, according to the sign of the
original number.
38. Float to binary
Conversion Example
Convert 0.1015625 to IEEE 32-bit floating point format.
0.1015625 × 2 = 0.203125 0 Generate 0 and continue.
0.203125 × 2 = 0.40625 0 Generate 0 and continue.
0.40625 × 2 = 0.8125 0 Generate 0 and continue.
0.8125 × 2 = 1.625 1 Generate 1 and continue with the rest.
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
STEP 1
So 0.101562510 = 0.00011012.
39. Float to binary
Conversion Example
Convert 0.1015625 to IEEE 32-bit floating point format.
STEP 2
Normalize: 0.00011012 = 1.1012 × 2-4.
STEP 3
Mantissa is 10100000000000000000000, exponent is -4 + 127 = 123 =
011110112, sign bit is 0
So 0.1015625 is 00111101110100000000000000000000 = 3dd0000016
41. const
● The const keyword is used to create a read only variable.
● Once initialised, the value of the variable cannot be changed but
can be used just like any other variable.
● Example:
● const float pi = 3.14;
42. register
● Registers are faster than memory to access, so the variables which
are most frequently used in a C program can be put in registers
using register keyword.
● Syntax
register data_type variable;
● Example:
● register int i;
44. Range
Qualifier Bytes Range
short 2 -32768 to 32767
long 8 -28
to +(28
- 1)
Qualifier Bytes Range
signed int 4 -2147483648 to 2147483647
unsigned int 4 0 to 4294967295
Size Qualifiers
Signed Qualifiers
DIY: Calculate the range for long long if the size is 12 bytes
Examples:
1. char ch; // Default qualifier is implementation dependent
2. int a; // Always it is signed
48. Simple Statements
● May be expression / function call terminated by semicolon(;)
Example Description
A = 2; Assignment statement
x = a + 3; The result of (a + 3) assign to x
4 + 5; has no effect, will be discarded by
smartcompilers
; is a valid statement as it is a part of the statement, and not
just a statement terminator as in Pascal.
49. Compound Statements
And its need
● Compound statements come in two varieties: conditionals and loops.
Output?
51. Declaration
● A declaration specifies a type, and contains a list of one
or more variables of that type.
● Example
int lower, upper, step;
char ch;
Declaration is an announcement and can be done 1 or more times.
52. Definition
● A definition associates an object name with a memory.
● Example
int lower = 10;
char ch = 'A';
Definition is an actual execution and should be done exactly once.
68. Type Conversion:
Implicit
● Automatic Unary conversions
● All operands of type char & short are converted to int before any operations
● Automatic Binary conversions
●
If one operand is of LOWER RANK data type & other is of
HIGHER RANK data type then LOWER RANK will be converted
to HIGHER RANK while evaluating the expression.
● Example
If one operand is int & other is float then, int is converted to float.
69. Type Conversion:
Implicit
● Type conversions in assignments
● The type of right hand side operand is converted to type of left
hand side operand in assignment statements.
● If type of operand on right hand side is LOWER RANK data type &
left hand side is of HIGHER RANK data type then LOWER RANK will
be promoted to HIGHER RANK while assigning the value.
● If type of operand on right hand side is HIGHER RANK data type & left hand side is of
LOWER RANK data type then HIGHER RANK will be demoted to LOWER RANK while
assigning the value.
● Example
Fractional part will be truncated during conversion of float to int.
77. Relational Operators
Operator Description Associativity
>
>=
<
<=
Greater than
Greater than or equal to
Less than
Less than or equal to
L to R
==
!=
Equal
Not equal
L to R
Output ?
78. Assignment Operators
Output ?
● An assignment operator is used to assign a constant / value of one variable to
another
Output ?
79. Bitwise Operators
Opera
tor
How to read Description Example
& Bitwise
AND
Bitwise ANDing all the bits in two
operands
A = 60 = 0011 1100
B = 13 = 0000 1101
(A & B) = 12 = 0000 1100
| Bitwise
OR
Bitwise ORing all the bits in two
operands
A = 60 = 0011 1100
B = 13 = 0000 1101
(A | B) = 61 = 0011 1101
^ Bitwise
XOR
Bitwise XORing all the bits in two
operands
A = 60 = 0011 1100
B = 13 = 0000 1101
(A ^ B) = 49 = 0011 0001
~ Compliment Complimenting all the bits in given
operand
A = 60 = 0011 1100
(~A) = -61 = 1100 0011
>> Bitwise
Right shift
Shift all the bits right n times by
introducing zeros left
A = 60 = 0011 1100
(A << 2) = 240 = 1111 0000
<< Bitwise
Left shift
Shift all the bits left n times by
introducing zeros right
A = 60 = 0011 1100
(A >> 2) = 15 = 1111 0000
Bit wise operators are very powerful, extensively used in low level
programming. This helps to deal with hardware (Ex: registers)
efficiency.
80. Sizeof() Operator
Output ?
● The sizeof operator returns the size of its operand in bytes.
Output ?
The only C operators, which operate during compilation itself,
i.e. a compile-time operator
81. Sizeof() Operator...
● 3 reasons for why sizeof is not a function:
● Any type of operands,
● Type as an operand,
● No brackets needed across operands
Output ?
83. Precedence & Associativity
Of Operators
Operators Associativity Precedence
() [] -> . L - R HIGH
! ++ −− + - * & (type) sizeof∼ R - L
/ % * L - R
+ - L - R
<< >> L - R
< <= > >= L - R
== != L - R
& L - R
^ L – R
| L - R
&& L - R
|| L - R
?: R - L
= += -= *= /= %= &= ^= |= <<= >>= R - L
, L - R LOW
84. Circuit logical
operators
● These operators are similar to the & and | operators that are
applied to Boolean type
● Have the ability to “short circuit” a calculation if the result is
definitely known, this can improve efficiency
• AND operator &&
• If one operand is false, the result is false.
• OR operator ||
• If one operand is true, the result is true.
88. Run time Layout
Run-time memory includes four (or more) segments
• Text area: program text
• Global data area: global & static variables
• Allocated during whole run-time
Stack: local variables & parameters
• A stack entry for a functions
• Allocated (pushed) - When entering a function
• De-allocated (popped) - When the function returns
Heap
• Dynamic memory
• Allocated by malloc()
• De-allocated by free()
89. Details
Text Segment: The text segment contains the actual code to be
executed. It's usually sharable, so multiple instances of a program
can share the text segment to lower memory requirements. This
segment is usually marked read-only so a program can't modify its
own instructions.
Initialized Data Segment: This segment contains global variables
which are initialized by the programmer.
Uninitialized Data Segment: Also named “BSS" (block started by
symbol) which was an operator used by an old assembler. This
segment contains uninitialized global variables. All variables in this
segment are initialized to 0 or NULL pointers before the program
begins to execute.
90. Details
The Stack: The stack is a collection of stack frames which will be
described in the next section. When a new frame needs to be added
(as a result of a newly called function), the stack grows downward
The Heap: Most dynamic memory, whether requested via C's
malloc() . The C library also gets dynamic memory for its own
personal workspace from the heap as well. As more memory is
requested "on the fly", the heap grows upward
92. Storage
Class
Scope Lifetime Memory Allocation
auto Within the
block /
Function
Till the end of the block /
function
Stack
Register Within the
block /
Function
Till the end of the block /
function
Register
Static
local
Within the
block /
Function
Till the end of the program Data Segment
Static
global
File Till the end of the program Data segment
extern Program Till the end of the program Data segment
Storage Classes
93. Storage Classes...
Variable Storage Class Memory
Allocation
global No .BSS
global1 No Initialized data
segment
global2 Static global .BSS
global3 Static global Initialized data
segment
local auto stack
local1 Static local .BSS
local2 Static local Initialized data
segment
i Register Registers
96. Typedefs
● Typedef are the alternative names given to the existing names.
● Mostly used with user defined data types when names of the existing data types
gets complicated.
General Syntax:
Example:
typedef existing_name new_name
typedef unsigned long int size_t