Team Emertxe
Advanced Pointers,
Arrays and Functions
Assignment 5
Assignment 5
Assignment 5
WAP to implement fragments using Array of Pointers
Assignment 5
WAP to implement fragments using Array of Pointers
Input:
Assignment 5
WAP to implement fragments using Array of Pointers
Input: Read number of rows and no of columns for each row and
read elements for each row
Assignment 5
WAP to implement fragments using Array of Pointers
Input: Read number of rows and no of columns for each row and
read elements for each row
Output:
Assignment 5
WAP to implement fragments using Array of Pointers
Input: Read number of rows and no of columns for each row and
read elements for each row
Output: Calculate average for each row separately and sort
each row based on average and print row elements
Examples:-
Assignment 5
Examples:-
 Read Number of rows/fragments(n)
 Assume n = 3
Assignment 5
Examples:-
 Read Number of rows/fragments(n)
 Assume n = 3
Assignment 5
500
504
508
Examples:-
 Read Number of elements/columns in each rows/fragment.
 Assume in 1st row = 3 elements/columns
2nd row = 2 elements/columns
3rd row = 4 elements/columns
Assignment 5
1000
2000
3000
500
504
508
1000 1008
1004
2000 2004
3000 3012
3008
3004
Examples:-
 Allocate one extra column for storing average of each row.
Assignment 5
500
504
508
1000 1008
1004
2000 2004
3000 3012
3008
3004
1000
2000
3000
Examples:-
 Initialize one more array to store number of columns in each
row.
Assignment 5
500
504
508
1000 1008
1004
2000 2004
3000 3012
3008
3004
1000
2000
3000
4 3 5
int arr
Examples:-
 Read the elements in each row.
Assignment 5
500
504
508
30 5 18
12 6
1 8 6 2
1000 1008
1004
2000 2004
3000 3012
3008
3004
1000
2000
3000
4 3 5
int arr
Examples:-
 Calculate the average for each row and store it in last index of
each row.
Assignment 5
500
504
508
30 5 18 17.6
12 6 9
1 8 6 2 4.25
1000 1008
1004
2000 2004
3000 3012
3008
3004
1000
2000
3000
4 3 5
int arr
Examples:-
 Compare the average of each row and sort the rows
accordingly.
Assignment 5
500
504
508
30 5 18 17.6
12 6 9
1 8 6 2 4.25
1000 1008
1004
2000 2004
3000 3012
3008
3004
1000
2000
3000
Swap 3000
and 1000
4 3 5
int arr
Examples:-
 Compare the average of each row and sort the rows
accordingly.
Assignment 5
500
504
508
30 5 18 17.6
12 6 9
1 8 6 2 4.25
1000 1008
1004
2000 2004
3000 3012
3008
3004
3000
2000
1000
5 3 4
int arr
Sample execution:-
Assignment 5
Sample execution:-
Assignment 5
Sample execution:-
Assignment 5
Sample execution:-
Assignment 5
Assignment 5
Pre-requisites:-
Assignment 5
Pre-requisites:-
⮚ Pointers
Assignment 5
Pre-requisites:-
⮚ Pointers
⮚ Functions
Assignment 5
Pre-requisites:-
⮚ Pointers
⮚ Functions
⮚ Dynamic memory allocation
Assignment 5
Pre-requisites:-
⮚ Pointers
⮚ Functions
⮚ Dynamic memory allocation
Objective:-
Assignment 5
Pre-requisites:-
⮚ Pointers
⮚ Functions
⮚ Dynamic memory allocation
Objective:-
⮚ To understand the concept of DMA and array of pointers
Team Emertxe
Thank you

05_fragments.pdf