Team Emertxe
Advanced Pointers,
Arrays and Functions
Assignment 3
Assignment 3
Assignment 3
WAP to convert Little Endian data to Big Endian.
Assignment 3
WAP to convert Little Endian data to Big Endian.
Input:
Assignment 3
WAP to convert Little Endian data to Big Endian.
Input: Read size ‘S’ (in bytes 2 or 4) and read ‘num’ as hexa
(based on ‘S’)
Assignment 3
WAP to convert Little Endian data to Big Endian.
Input: Read size ‘S’ (in bytes 2 or 4) and read ‘num’ as hexa
(based on ‘S’)
Output:
Assignment 3
WAP to convert Little Endian data to Big Endian.
Input: Read size ‘S’ (in bytes 2 or 4) and read ‘num’ as hexa
(based on ‘S’)
Output: Print ‘num’ in Big endian format.
Assignment 3
What is Endianness?
Assignment 3
What is Endianness?
 The order or sequence of bytes of a work of digital data in
computer memory.
Assignment 3
What is Endianness?
 The order or sequence of bytes of a work of digital data in
computer memory.
 There are two types:
Assignment 3
What is Endianness?
 The order or sequence of bytes of a work of digital data in
computer memory.
 There are two types:
1. Little endian
Assignment 3
What is Endianness?
 The order or sequence of bytes of a work of digital data in
computer memory.
 There are two types:
1. Little endian
2. Big endian
Assignment 3
What is Little Endian?
Assignment 3
What is Little Endian?
 The most significant byte stored at the highest address.
Assignment 3
What is Little Endian?
 The most significant byte stored at the highest address.
 Example:
Assignment 3
What is Little Endian?
 The most significant byte stored at the highest address.
 Example:
num = 0x12345678;
Assignment 3
What is Little Endian?
 The most significant byte stored at the highest address.
 Example:
num = 0x12345678; 78 56 34 12
100 101 102 103
Assignment 3
What is Big Endian?
Assignment 3
What is Big Endian?
 The most significant byte stored at the lowest address.
Assignment 3
What is Big Endian?
 The most significant byte stored at the lowest address.
 Example:
Assignment 3
What is Big Endian?
 The most significant byte stored at the lowest address.
 Example:
num = 0x12345678;
Assignment 3
What is Big Endian?
 The most significant byte stored at the lowest address.
 Example:
num = 0x12345678; 12 34 56 78
100 101 102 103
Assignment 3
Example :-
Assignment 3
Example :-
Input:
Assignment 3
Example :-
Input: S = 2 , num = 0xABCD
Assignment 3
Example :-
Input: S = 2 , num = 0xABCD CD AB
100 101
Assignment 3
Example :-
Input: S = 2 , num = 0xABCD
Output:
CD AB
100 101
Assignment 3
Example :-
Input: S = 2 , num = 0xABCD
Output: 0xCDAB
CD AB
100 101
Assignment 3
Example :-
Input: S = 2 , num = 0xABCD
Output: 0xCDAB
Input: S = 2 , num = 0x1234
CD AB
100 101
Assignment 3
Example :-
Input: S = 2 , num = 0xABCD
Output: 0xCDAB
Input: S = 2 , num = 0x1234
CD AB
100 101
34 12
200 201
Assignment 3
Example :-
Input: S = 2 , num = 0xABCD
Output: 0xCDAB
Input: S = 2 , num = 0x1234
Output: 0x3412
CD AB
100 101
34 12
200 201
Sample execution:-
Assignment 3
Sample execution:-
Assignment 3
Sample execution:-
Assignment 3
Assignment 3
Pre-requisites:-
Assignment 3
Pre-requisites:-
 Pointers
Assignment 3
Pre-requisites:-
 Pointers
Objective:-
Assignment 3
Pre-requisites:-
 Pointers
Objective:-
 To understand the concept of Big Endian and Little Endian
representation.
Team Emertxe
Thank you

03_endianess.pdf