This presentation is part of training session delivered during Train The Trainer (TOT) program on Embedded Software Engineer job role supported by ESSCI.
This presentation is part of training session delivered during Train The Trainer (TOT) program on Embedded Software Engineer job role supported by ESSCI.
This presentation is part of training session delivered during Train The Trainer (TOT) program on Embedded Software Engineer job role supported by ESSCI.
C programming, RTS Tech. Indore
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
A few Programs, that are tested with compilers of respective IDEs s Bloodshed-DevC++, Visual Studio 2008, Qt 4.2. These are running successfully within console window of windows platform. So just enjoy coding. Programs in C of College days.
Download this Presentation for free from www.ecti.co.in/downloads.html
No SIGN UP REQUIRED.
C++ Programming Training PPTs / PDFs for free.
Download free C++ Programming study material. Learn C++ Programming for free in 2 hours.
Placement Papers are published here to help freshers to get themselves prepared for the tests and successfully procure jobs in top companies of India including Infosys, Wipro, TCS, HCL, HP, Accenture, CTS etc. This is the section where you can find previous and latest questions, practice them with the solutions in hand.
following is work on Advance Python part 1 Functional Programming in Python
for code and more details plz do visit
https://lnkd.in/dnQF95z
for more free study material and Projects follow on
Github
https://lnkd.in/gYKtuB3
LinkedIn
https://lnkd.in/daSvf_P
#python #datascience #programming #machinelearning #github #deeplearning #coding #developer #projects #work #developers #linkedin #google #amazonindia#IBM
Python Exception Handling
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
Python: Object oriented programming, RTS Tech. Indore
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
The aptitude test consisted tricky questions on core subjects of CSE like C , C++, Java ,Data Structures, Database, Computer Networks, Theory of Computation.
(video of these slides available here http://fsharpforfunandprofit.com/fppatterns/)
In object-oriented development, we are all familiar with design patterns such as the Strategy pattern and Decorator pattern, and design principles such as SOLID.
The functional programming community has design patterns and principles as well.
This talk will provide an overview of some of these, and present some demonstrations of FP design in practice.
C programming, RTS Tech. Indore
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
A few Programs, that are tested with compilers of respective IDEs s Bloodshed-DevC++, Visual Studio 2008, Qt 4.2. These are running successfully within console window of windows platform. So just enjoy coding. Programs in C of College days.
Download this Presentation for free from www.ecti.co.in/downloads.html
No SIGN UP REQUIRED.
C++ Programming Training PPTs / PDFs for free.
Download free C++ Programming study material. Learn C++ Programming for free in 2 hours.
Placement Papers are published here to help freshers to get themselves prepared for the tests and successfully procure jobs in top companies of India including Infosys, Wipro, TCS, HCL, HP, Accenture, CTS etc. This is the section where you can find previous and latest questions, practice them with the solutions in hand.
following is work on Advance Python part 1 Functional Programming in Python
for code and more details plz do visit
https://lnkd.in/dnQF95z
for more free study material and Projects follow on
Github
https://lnkd.in/gYKtuB3
LinkedIn
https://lnkd.in/daSvf_P
#python #datascience #programming #machinelearning #github #deeplearning #coding #developer #projects #work #developers #linkedin #google #amazonindia#IBM
Python Exception Handling
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
Python: Object oriented programming, RTS Tech. Indore
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
The aptitude test consisted tricky questions on core subjects of CSE like C , C++, Java ,Data Structures, Database, Computer Networks, Theory of Computation.
(video of these slides available here http://fsharpforfunandprofit.com/fppatterns/)
In object-oriented development, we are all familiar with design patterns such as the Strategy pattern and Decorator pattern, and design principles such as SOLID.
The functional programming community has design patterns and principles as well.
This talk will provide an overview of some of these, and present some demonstrations of FP design in practice.
Career Development. its about you identifying your potentials and developing them no matter the circumstances.
its best to do want you love doing best so that you can working hours in your lifetime than feel miserable doing something you don't like for about twenty years.
believe in yourself and don't let any thing discourage you.
A Case Study on BPR(Business Process Reengineering) implementation at a manufacturing Organization is presented. It was a practical example of BPR concept introduced by Dr. Michael Hammer where dramatic improvement in performance,cost ,and speed were realized in Business processes.
Programming is an essential skill if you seek a career in software development, or in other fields of Coding. This fundamental of programming course is the first in the specialization for Introduction to Programming in C, but its lessons extend to any language you might want to study. This is because programming is primarily about solving a set of problems and writing the algorithm.
Embedded C programming based on 8051 microcontrollerGaurav Verma
This lecture note covers the embedded 'c' programming constructs based on 8051 microcontroller. Although the same concepts can be used for other advanced microcontrollers with some modifications.
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxvrickens
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition pg. 25
An Introduction to
Computer Science with Java, Python and C++
Community College of Philadelphia edition
Copyright 2017 by C.W. Herbert, all rights reserved.
Last edited October 8, 28, 2019 by C. W. Herbert
This document is a draft of a chapter from An Introduction to Computer Science with Java, Python and C++, written by Charles Herbert. It is available free of charge for students in Computer Science courses at Community College of Philadelphia during the Fall 2019 semester. It may not be reproduced or distributed for any other purposes without proper prior permission.
Please report any typos, other errors, or suggestions for improving the text to [email protected]
Chapter 5 – Python Functions and Modular Programming
Contents
Lesson 5.1User Created Functions in Python2
Python Function Parameters2
Value returning functions3
Example – Methods and Parameter Passing5
9
Lesson 5.2Top-Down Design and Modular Development10
Chapter Exercises13
User Created Functions in Python
So far we have only created software with one continuous Python script. We have used functions from other python modules, such as the square root method from the math class math.sqrt(n). Now we will begin to create our own functions of our own.
A Python function is a block of code that can be used to perform a specific task within a larger computer program. It can be called as needed from other Python software. Most programming languages have similar features, such as methods in Java or subroutines in system software.
The code for user-defined functions in Python is contained in a function definition. A Python function definition is a software unit with a header and a block of Python statements. The header starts with the keyword def followed by the name of the function, then a set parenthesis with any parameters for the function. A colon is used after the parentheses to indicate a block of code follows, just as with the if and while statements. The block of code to be included within the function is indented.
Here is an example of a Python function:
# firstFunction.py
# first demonstration of the use of a function for CSCI 111
# last edited 10/08/2o19 by C. Herbert
function
definition
def myFunction():
print ( "This line being printed by the function MyFunction.\n")
# end myFunction()
### main program ###
function used by the main part of the script
print("Beginning\n")
myFunction()
print("End\n")
# end main program
Functions can used for code that will be repeated within a program, or for modular development, in which long programs are broken into parts and the parts are developed independently. The parts can be developed as Python functions, then integrated to work together by being called from other software.
Python Function Parameters
Data can be passed to a Python function as a parameter of the function. Function parameters are variables listed in parentheses foll ...
C Programming Training In Ambala ! BATRA COMPUTER CENTREjatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide C Programming Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
1. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 1
Session 3
Developing Software
Module
2. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Agenda
Session 1
History of C
Fundamentals of C
Data Types
Variables, Constants and Arrays
Keywords
Decision Control (if-else)
Session 2
Loops
Functions (Overview)
Arrays
Session 3
Pointers & String
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 2
3. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Strings
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 3
4. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Definition
Character Arrays and Strings
Strings:
Are enclosed in double quotes "string"
Are terminated by a null character '0'
Must be manipulated as arrays of characters (treated
element by element)
May be initialized with a string literal
Strings are arrays of char whose last element is a null
character '0' with an ASCII value of 0. C has no native
string data type, so strings must always be treated as
character arrays.
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 4
5. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Syntax
Example
Creating a String Character Array
char str1[10]; //Holds 9 characters plus '0'
char str2[6]; //Holds 5 characters plus '0'
char arrayName[length];
Strings are created like any other array of char:
length must be one larger than the length of the string to
accommodate the terminating null character '0'
A char array with n elements holds strings with n-1 char
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 5
6. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Syntax
How to Initialize a String at Declaration
char str1[] = "Microchip"; //10 chars "Microchip0"
char str2[6] = "Hello"; //6 chars "Hello0"
//Alternative string declaration – size required
char str3[4] = {'P', 'I', 'C', '0'};
char arrayName[] = "Microchip";
Character arrays may be initialized with string literals:
Array size is not required
Size automatically determined by length of string
NULL character '0' is automatically appended
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 6
7. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Syntax
Example
How to Initialize a String in Code
str[0] = 'H';
str[1] = 'e';
str[2] = 'l';
str[3] = 'l';
str[4] = 'o';
str[5] = '0';
arrayName[0] = char1;
arrayName[1] = char2;
arrayName[n] = '0';
In code, strings must be initialized element by element:
Null character '0' must be appended manually
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 7
8. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Comparing Strings
Strings cannot be compared using relational operators
(==, !=, etc.)
Must use standard C library string manipulation
functions
strcmp() returns 0 if strings equal
char str[] = "Hello";
if (!strcmp( str, "Hello"))
printf("The string is "%s".n", str);
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 8
9. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Data Pointers
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 9
10. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
A Variable's Address versus A Variable's Value
In some situations, we will want to work with a variable's
address in memory, rather than the value it contains…
005A
Address
16-bit Data Memory
(RAM)
0x0802
0x0804
0x0806
0x0808
0x0800
x
Variable stored
at Address
0123
DEAD
BEEF
F00D
0456 0x080A
Variable name
from C code
int x;
Value of
variable x
= 0x0123
Address of
variable x
= 0x0802
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 10
11. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
What are pointers?
A pointer is a variable or constant that holds the
address of another variable or function
FFFF
Address
16-bit Data Memory
(RAM)
0x0802
0x0804
0x0806
0x0808
0x0800
x
p
Variable at
Address
0123
FFFF
0802
FFFF
FFFF 0x080A
Integer Variable:
Pointer Variable:
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 11
12. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
What do they do?
A pointer allows us to indirectly access a variable
(just like indirect addressing in assembly language)
005A
Address
16-bit Data Memory
(RAM)
0x0802
0x0804
0x0806
0x0808
0x0800
x 0123
DEAD
0802
F00D
0456 0x080A
p
x = 0x0123;
*p = 0x0123;
Direct Access
via x
Indirect Access
via *p
p points to x
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 12
13. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Syntax
How to Create a Pointer Variable
int *iPtr; // Create a pointer to int
float *fPtr; // Create a pointer to float
type *ptrName;
In the context of a declaration, the * merely indicates that the
variable is a pointer
type is the type of data the pointer may point to
Pointer usually described as “a pointer to type”
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 13
14. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
To set a pointer to point to another variable, we use the
& operator (address of), and the pointer variable is
used without the dereference operator *:
This assigns the address of the variable x to the
pointer p (p now points to x)
Note: p must be declared to point to the type of x (e.g.
int x; int *p;)
Initialization
p = &x;
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 14
15. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Usage
When accessing the variable pointed to by a pointer,
we use the pointer with the dereference operator *:
This assigns to the variable y, the value of what p is
pointing to (x from the last slide)
Using *p, is the same as using the variable it points to
(e.g. x)
y = *p;
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 15
16. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Another Way To Look At The Syntax
&x is a constant pointer
It represents the address of x
The address of x will never change
p is a variable pointer to int
It can be assigned the address of any int
It may be assigned a new address any time
int x, *p; //int and a pointer to int
p = &x; //Assign p the address of x
*p = 5; //Same as x = 5;
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 16
17. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Another Way To Look At The Syntax
*p represents the data pointed to by p
*p may be used anywhere you would use x
* is the dereference operator, also called the
indirection operator
In the pointer declaration, the only significance of * is
to indicate that the variable is a pointer rather than an
ordinary variable
int x, *p; //1 int, 1 pointer to int
p = &x; //Assign p the address of x
*p = 5; //Same as x = 5;
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 17
18. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
How Pointers Work
Address
16-bit Data Memory
(RAM)
0x08BC
0x08BE
0x08C0
0x08C2
0x08C4
0x08C6
0x08BA
{
int x, y;
int *p;
x = 0xDEAD;
y = 0xBEEF;
p = &x;
*p = 0x0100;
p = &y;
*p = 0x0200;
}
x
y
p
Variable at
Address
0x08C8
0000
0000
0000
0000
0000
0000
0000
0000
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 18
19. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
How Pointers Work
Address
16-bit Data Memory
(RAM)
0x08BC
0x08BE
0x08C0
0x08C2
0x08C4
0x08C6
0x08BA
x
y
p
Variable at
Address
0x08C8
0000
DEAD
0000
0000
0000
0000
0000
0000
{
int x, y;
int *p;
x = 0xDEAD;
y = 0xBEEF;
p = &x;
*p = 0x0100;
p = &y;
*p = 0x0200;
}
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 19
20. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
How Pointers Work
Address
16-bit Data Memory
(RAM)
0x08BC
0x08BE
0x08C0
0x08C2
0x08C4
0x08C6
0x08BA
x
y
p
Variable at
Address
0x08C8
0000
DEAD
BEEF
0000
0000
0000
0000
0000
{
int x, y;
int *p;
x = 0xDEAD;
y = 0xBEEF;
p = &x;
*p = 0x0100;
p = &y;
*p = 0x0200;
}
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 20
21. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
How Pointers Work
Address
16-bit Data Memory
(RAM)
0x08BC
0x08BE
0x08C0
0x08C2
0x08C4
0x08C6
0x08BA
x
y
p
Variable at
Address
0x08C8
0000
DEAD
BEEF
08BC
0000
0000
0000
0000
{
int x, y;
int *p;
x = 0xDEAD;
y = 0xBEEF;
p = &x;
*p = 0x0100;
p = &y;
*p = 0x0200;
}
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 21
22. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
How Pointers Work
Address
16-bit Data Memory
(RAM)
0x08BC
0x08BE
0x08C0
0x08C2
0x08C4
0x08C6
0x08BA
x
y
p
Variable at
Address
0x08C8
0000
0100
BEEF
08BC
0000
0000
0000
0000
{
int x, y;
int *p;
x = 0xDEAD;
y = 0xBEEF;
p = &x;
*p = 0x0100;
p = &y;
*p = 0x0200;
}
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 22
23. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
How Pointers Work
Address
16-bit Data Memory
(RAM)
0x08BC
0x08BE
0x08C0
0x08C2
0x08C4
0x08C6
0x08BA
x
y
p
Variable at
Address
0x08C8
0000
0100
BEEF
08BE
0000
0000
0000
0000
{
int x, y;
int *p;
x = 0xDEAD;
y = 0xBEEF;
p = &x;
*p = 0x0100;
p = &y;
*p = 0x0200;
}
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 23
24. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
How Pointers Work
Address
16-bit Data Memory
(RAM)
0x08BC
0x08BE
0x08C0
0x08C2
0x08C4
0x08C6
0x08BA
x
y
p
Variable at
Address
0x08C8
0000
0100
0200
08BE
0000
0000
0000
0000
{
int x, y;
int *p;
x = 0xDEAD;
y = 0xBEEF;
p = &x;
*p = 0x0100;
p = &y;
*p = 0x0200;
}
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 24
25. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Post-Increment/Decrement Syntax Rule
Care must be taken with respect to operator precedence
when doing pointer arithmetic:
Syntax Operation Description by Example
Post-Increment
data pointed to
by Pointer
(*p)++
Post-Increment
Pointer
*p++
*(p++)
z = (*p)++;
is equivalent to:
z = *p;
*p = *p + 1;
z = *(p++);
is equivalent to:
z = *p;
p = p + 1;
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 25
26. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Post-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0002
0003
0800
0000
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(p++);
y = 5 + (*p)++;
}
Remember:
*(p++) is the same as *p++
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 26
27. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Post-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0002
0003
0800
0006
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(p++);
y = 5 + (*p)++;
}
Remember:
*(p++) is the same as *p++
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 27
28. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Post-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0002
0003
0802
0006
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(p++);
y = 5 + (*p)++;
}
Remember:
*(p++) is the same as *p++
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 28
29. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Post-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0002
0003
0802
0007
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(p++);
y = 5 + (*p)++;
}
Remember:
*(p++) is the same as *p++
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 29
30. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Post-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0003
0003
0802
0007
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(p++);
y = 5 + (*p)++;
}
Remember:
*(p++) is the same as *p++
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 30
31. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Pre-Increment/Decrement Syntax Rule
Care must be taken with respect to operator
precedence when doing pointer arithmetic:
Syntax Operation Description by Example
Pre-Increment
data pointed to
by Pointer
++(*p)
Pre-Increment
Pointer
++*p
*(++p)
z = ++(*p);
is equivalent to:
*p = *p + 1;
z = *p;
z = *(++p);
is equivalent to:
p = p + 1;
z = *p;
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 31
32. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Pre-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0002
0003
0800
0000
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(++p);
y = 5 + ++(*p);
}
Remember:
*(++p) is the same as *++p
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 32
33. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Pre-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0002
0003
0802
0000
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(++p);
y = 5 + ++(*p);
}
Remember:
*(++p) is the same as *++p
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 33
34. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Pre-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0002
0003
0802
0007
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(++p);
y = 5 + ++(*p);
}
Remember:
*(++p) is the same as *++p
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 34
35. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Pre-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0003
0003
0802
0007
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(++p);
y = 5 + ++(*p);
}
Remember:
*(++p) is the same as *++p
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 35
36. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Pre-Increment / Decrement Syntax
Address
16-bit Data Memory
(RAM)
0x0800
0x0802
0x0804
0x0806
0x0808
0x080A
0x07FE
x[0]
x[1]
x[2]
0x080C
0000
0001
0003
0003
0802
0008
0000
0000
p
y
{
int x[3] = {1,2,3};
int y;
int *p = &x;
y = 5 + *(++p);
y = 5 + ++(*p);
}
Remember:
*(++p) is the same as *++p
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 36
37. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
The parentheses determine what gets incremented/
decremented:
Pre- and Post- Increment/Decrement Summary
Modify the pointer itself
*(++p) or *++p and *(p++) or *p++
Modify the value pointed to by the pointer
++(*p) and (*p)++
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 37
38. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Example
Initialization Tip
If a pointer isn't initialized to a specific address when it
is created, it is a good idea to initialize it as NUL
(pointing to nowhere)
This will prevent it from unintentionally corrupting a
memory location if it is accidentally used before it is
initialized
int *p = NUL;
NULL is the character '0' but NUL is the value of a
pointer that points to nowhere
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 38
39. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Conclusion
Pointers are variables that hold the address of other
variables.
Pointers make it possible for the program to change
which variable is acted on by a particular line of code .
Incrementing and decrementing pointers will modify
the value in multiples of the size of the type they point
to.
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 39
40. Training Of Trainers (TOT) program on
Embedded Software Engineer Job role
Thank you!
www.emtech.in 24x7 Helpline +91 92120 88881 info@emtech.in 40