Structure Packing in C

  Рет қаралды 127,556

Neso Academy

Neso Academy

Күн бұрын

C Programming: Structure Packing in C Programming.
Topics discussed:
1) Structure Packing.
2) The need for Structure Packing.
C Programming Lectures: goo.gl/7Eh2SS
Follow Neso Academy on Instagram: @nesoacademy(bit.ly/2XP63OE)
Follow me on Instagram: @jaspreetedu(bit.ly/2YX26E5)
Contribute: www.nesoacademy...
Memberships: bit.ly/2U7YSPI
Books: www.nesoacademy...
Website ► www.nesoacademy...
Forum ► forum.nesoacade...
Facebook ► goo.gl/Nt0PmB
Twitter ► / nesoacademy
Music:
Axol x Alex Skrindo - You [NCS Release]
#CProgrammingByNeso #CProgramming #StructuresInC #StructurePacking #Structure&Union

Пікірлер: 46
@hemasundarkasturi5439
@hemasundarkasturi5439 5 жыл бұрын
thank you a lot for sharing the knowledge 😊😊
@shashankgaur18
@shashankgaur18 5 жыл бұрын
First view... I was totally unaware of this concept so thank you neso academy
@joel_b9216
@joel_b9216 5 жыл бұрын
Great video as always! Your videos save me so much time. Thanks a lot.
@AbhishekSingh-cu1fe
@AbhishekSingh-cu1fe 4 жыл бұрын
Thank you sir
@embedded3696
@embedded3696 9 ай бұрын
ultimate video, easy understanding
@shreyasingh222
@shreyasingh222 3 жыл бұрын
Outstanding....
@Cat_Sterling
@Cat_Sterling 4 жыл бұрын
Thank you so much, had no idea that it could be done!
@sazadahemad2799
@sazadahemad2799 4 жыл бұрын
learnt a new thing.... thanx neso
@oksowhat
@oksowhat 2 жыл бұрын
sir as in previous example where 12bytes were used and 3cpu cycles then still if we did't used padding then the fisrt char will use 1 byte 2nd int will use next 3 bytes of first word and 1 byte in 2nd word and 3rd char will use 1 byte in 2nd word, total of 2 cycle being used, this is inefficient
@ankammaraochintala2509
@ankammaraochintala2509 3 жыл бұрын
Thank you sir, for your knowledge transfer
@AamirKhan-de7hg
@AamirKhan-de7hg 2 жыл бұрын
#include struct abc{ double x; int y; } ; int main() { printf("%d",sizeof(struct abc)); }
@preciouslife1212
@preciouslife1212 2 жыл бұрын
great video sir
@sivaramakrishna26
@sivaramakrishna26 4 жыл бұрын
The teaching about structure in detail is excellent. Can you please explain the #pragma directive in detail
@Mehraj_IITKGP
@Mehraj_IITKGP Жыл бұрын
This directive is a special purpose directive and is used to turn on or off some features. These types of directives are compiler-specific i.e., they vary from compiler to compiler. -- For example, #pragma warn Directive is used to hide the warning messages which are displayed during compilation, it can be used as: #pragma warn +xxx (To show the warning) #pragma warn -xxx (To hide the warning) -- #pragma GCC poison is supported by the GCC compiler and is used to remove an identifier completely from the program. It can be used as #pragma GCC poison printf to poison printf keyword. Similarly, it has many uses. The only feature I use is #paragma pack(1).
@parishush
@parishush 4 жыл бұрын
Thank you
@mgproductions396
@mgproductions396 4 жыл бұрын
Great video
@johnh1353
@johnh1353 Жыл бұрын
You should still study your target architectures and not take all structure padding as bad ... most modern processor ISA's implement a "barrel shifter" to make fetch and put single cycle operations which based on structure types and order sometimes can't help but have some padding ... Binary packing is another technique to be studied that focuses at the byte shifting .. great for implementing protocols and working within the bounds of CPU caches
@QuratulainAzhar
@QuratulainAzhar 9 ай бұрын
bohat achay
@heetbhatt4511
@heetbhatt4511 3 жыл бұрын
is that necessary to save cpu cycle?
@vinayakgujjar9655
@vinayakgujjar9655 3 жыл бұрын
Nice one, bur was not as clear as structure padding video. Concern is how processor modulates its data accessing from 8bytes at a time to 6bytes.
@khalilchouchene7988
@khalilchouchene7988 Жыл бұрын
That's what am asking right now
@jeedikantivenkat7814
@jeedikantivenkat7814 5 жыл бұрын
First view First like First comment❤ Enough for the day .. Sir please provide videos on data structures .
@peasant12345
@peasant12345 Жыл бұрын
why not put low byte data types in front of high byte ones when you construct struct
@veeraloganathanvvs5495
@veeraloganathanvvs5495 10 ай бұрын
If I need both and optimise code means! What we have to do. ? Structure should be properly ordering?
@VishalMishra-jx8gs
@VishalMishra-jx8gs 5 жыл бұрын
sir please make video for all the subject
@AamirKhan-de7hg
@AamirKhan-de7hg 2 жыл бұрын
What will be the output of this program ??
@varunsaigs9815
@varunsaigs9815 Жыл бұрын
Then what is the size of that var in 62 bites architecture??
@deviganeshan838
@deviganeshan838 5 жыл бұрын
Sir... Pls update videos in operating system
@gsravan7058
@gsravan7058 4 жыл бұрын
But how pragma will work internally?? I want to know about internal process of pragma
@mcbotface
@mcbotface 5 жыл бұрын
Thank you once again sir Please add more video lectures in Discrete Mathematics playlist on topics like Relations, Functions, Graph Theory, Trees, Prefix Codes, Huffman coding, etc.
@FitTechCricketer
@FitTechCricketer 5 жыл бұрын
sir,but In 64 bit architecture 1 word =8 byte so without pragma pack it should be 8 na for char,int,char
@pradhanan9413
@pradhanan9413 3 жыл бұрын
Ya
@pradhanan9413
@pradhanan9413 3 жыл бұрын
But it's showing me 12 as output....please explain
@suhanibohra623
@suhanibohra623 4 жыл бұрын
is it always recommended to pack structures?
@RamKumar-fs9sd
@RamKumar-fs9sd 2 жыл бұрын
but which is more important for industry concepts?
@harshgupta4326
@harshgupta4326 3 жыл бұрын
sir is padding faster than packing
@taranjeetsingh6869
@taranjeetsingh6869 4 жыл бұрын
What would be loss if cpu cycle is increased?
@xrafter
@xrafter 4 жыл бұрын
More cpu cycle mean more time
@nishantraj9762
@nishantraj9762 2 жыл бұрын
Why (char*) ? Why not (char)
@yogeshmhanta2902
@yogeshmhanta2902 3 жыл бұрын
How many wastage of cpu cycles in a above program.
@worldproducer567
@worldproducer567 3 жыл бұрын
2 cycles Assuming Char takes 1 byte Int takes 4 byte because char a covers one word, int b covers 2 bytes of first word and 2 bytes of the next adjacent word, and char c covers one byte in the same word . Therefore two words are used and thus 2 CPU cycles are wasted
@arvindersingh9863
@arvindersingh9863 5 жыл бұрын
--attribute--((packed)); do same?
@venusdille8179
@venusdille8179 3 жыл бұрын
Tttoooppp
@mazharkhaliq1971
@mazharkhaliq1971 2 жыл бұрын
Thank you for the knowledge 😊
@ElifArslan-l9g
@ElifArslan-l9g 3 жыл бұрын
thank you
Structures in C (Solved Problem 1)
1:28
Neso Academy
Рет қаралды 113 М.
Introduction to Unions in C
6:58
Neso Academy
Рет қаралды 270 М.
БАБУШКА ШАРИТ #shorts
0:16
Паша Осадчий
Рет қаралды 4,1 МЛН
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 108 М.
C_116 Structure Padding in C | C Language Tutorials
18:25
Jenny's Lectures CS IT
Рет қаралды 109 М.
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,5 МЛН
Bit Fields in C. What are they, and how do I use them?
13:26
Jacob Sorber
Рет қаралды 87 М.
Structure Padding in C
8:42
Neso Academy
Рет қаралды 258 М.
the cleanest feature in C that you've probably never heard of
8:13
Ep 078: Data Structure Alignment and Endianness
12:19
Intermation
Рет қаралды 20 М.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 347 М.
The Rust Survival Guide
12:34
Let's Get Rusty
Рет қаралды 181 М.