I appreciate the work you put into these videos and your professorial style. The videos are a great resource for newbies and also as a refresher for some of us who like to keep our memories refreshed!
Superb... Keep doing... The way you explained the flow and the sequence ... Everything made me hit like ..if I could I would hit it many times.... Thank a lot
@@CppNuts Thank u for replying, my confusion was that the size of( struct date) is not a power of 2 or a multiple of 2, I thought that objects in C always occupies a space in memory that is either a power of 2 or a multiple of 2.
#include #include struct d0 { char vo : 3; int v1 : 7; }; int main() { printf("%d", sizeof(struct d0)); return 0; } I thought that I shall get 4 bytes as output as 32 bits (size of larger data type i.e; int) are enough to store 3 bits of char and 7 bits of int data type, But instead, I'm getting 8 bytes as output. Please tell me why I am getting so? Please answer @CppNuts
Thank you 🙏🏻 for explaining in detail... Now I understood fully about bit fields
I appreciate the work you put into these videos and your professorial style. The videos are a great resource for newbies and also as a refresher for some of us who like to keep our memories refreshed!
Thanks man!!
I have started my career in Embedded Systems, this topic is really helpful for me. Thank you!!
Nice illustrate. Keep it up.
Thanks Dude!!
Superb... Keep doing... The way you explained the flow and the sequence ... Everything made me hit like ..if I could I would hit it many times.... Thank a lot
Sabana Afrose, Thanks for your like and nice comment.
Really liked your videos .. simple .. short and to the point !
Thanks.. Man..!!
good explanation.
Thank you for your effort .
Thank man:!!
Arey Bhaiya, What an easy way of teaching !.
You explained it very well sir. I understood everything about bit field.
That's great!!
Thank you so much! This really helps me understand bit field in more detail! Thank you!
Glad that it helped.
8:51 sir, Why structural packing doesn't work in the above example it still give 8 bytes of size
On adding #pragma pack(1)
unsigned int day : 5;
unsigned int month : 4;
int year : 22;
So can reduce the size again.
Size : 4
Yes you can further use the same int for 1 Bit because 5+4+22 = 31 and int is 32 bits.
Congratulations from Brazil.
Thanks man!!
It was very helpful and I request to upload a tutorial regarding forward declaration in c++ in details and with depth analysis.thanks .
I am trying my best to upload as much as i can but i will keep this suggestion in my mind thanks dude!! :)
Very nice explanation. Thanks to you
Thanks
Best explanation of Bit Fields.
Thanks for the comment man!!
@@CppNuts thank you for your video!
Awesome video sir.. I learnt something new here...many thanks ..please make more videos on memory optimisation
Sure man i will try for this video.
beautifully explained. thanks
Thanks man!!
Awesome explanation...😊👍
sir your all cpp videos are great ^^
Glad you like them!
So nice and effective explanation Sir tq. ...
Thanks bro..
very nice discription
Thanks man!!
Very Clear! Thank U!
Great explanations - thank you
Thanks for your comment!!
struct date {
unsigned char day : 5 ;
unsigned char month : 4 ;
unsigned char year ;
} ;
printf("sizeof struct date : %d
",sizeof(struct date)) ; // output is 3
i'm using gcc default compilation .
Year one byte
Day + month is 2 bytes, because 5+4 is 9 bits which is more than one byte.
@@CppNuts Thank u for replying, my confusion was that the size of( struct date) is not a power of 2 or a multiple of 2, I thought that objects in C always occupies a space in memory that is either a power of 2 or a multiple of 2.
That is multiple of biggest data member in class or struct.
@@CppNuts yes, Thank u I get it now.Great video by the way, so much information gained.
Very helpful sir
Thank you sir
Most welcome!!
#include
#include
struct d0
{
char vo : 3;
int v1 : 7;
};
int main()
{
printf("%d", sizeof(struct d0));
return 0;
}
I thought that I shall get 4 bytes as output as 32 bits (size of larger data type i.e; int) are enough to store 3 bits of char and 7 bits of int data type, But instead, I'm getting 8 bytes as output.
Please tell me why I am getting so?
Please answer @CppNuts
Hi, I have an interview and the interviewer said I should be handy with bitfields
where can i see questions ?
I have bit field questions series plz check that out.
Awesome explanation..
Thanks man!!
What is the software you are using?
It is Sublime Text Editor 3.
Btw very good video!!
Thanks dude!!
The best teacher out there 😍😍
Thanks man..
Very good explanation.
I learned a lot.
Glad it was helpful!
How will allocate 16 bytes or 32 bytes in bit fields or large size?
I need this very much.Please explain
Please explain more, couldn't understand your question?
@@CppNuts Is there any restriction for allocating bit in bit fields?
Means, how many bits to allocate in bit field or no restriction.
Yes it is max of the type used. For more check this stackoverflow.com/questions/14553632/maximum-size-of-a-bit-field-in-c-or-c
@@CppNuts Thank
can you help me with allocating memory for black ops 3 for a mod. I want to add more assets into attachmentunique
thank you for the explanation sir
You are welcome dude..
Great video. But I don't understand why we can't have static variables with bit fields?
Why do you want that?
Nice explaination☺☺
It's my pleasure
Very good explanatuion... But one doubt actually we couldn't use that saved memory. Then why....
Notice that when we didn't use bit fields size was 12 but when we used bit fields then size became 8.
Thank you
Satish, welcome dude.
Great tutorial.. learnt alot.. :)
Thanks...
Loved it 💕
Thanks..
it was amazing.. thank you so much
Glad you liked it!
nice tut.
:)
Thanks man!!
great as always
Thanks dude!!
hi, voice is not clear pl check
At what point did you feel that? Please mention the timing in the video. Thanks
Sir plz tell me your git hub . I will copy the code
I am working on it.
Hey Yadav, i'm learning c++ by myself. Any comments or tips you cud giv me? I have no money to go to university. But Still i want to be a programmer.
Work hard like your life depends on it.
@@CppNuts C'mon dude,please give me more props.I mean, your fav book, anyhobbies concerning c++, you know.. that sort of things.
Doesn't really matter.
🙏🏼🙏🏼🙏🏼🙏🏼🙏🏼🙏🏼
Namaste..
nice
Thanks
it was nice
Thanks man!!
why does he need to place advertisement every 2 seconds, this is really annoying!!
Voice is too less
Sorry for that..