In this video I will show you a technique to automatically get the size of an array in C/C++ using sizeof operator without having to hard-code the value
I’m raising money to Support My Channel. Click to Donate Now:
Thank you for your support!
Nguồn:https://mcitmc.org/
Xem Thêm Bài Viết Khác:https://mcitmc.org/cong-nghe/
in c++ I can't put AR[ ]
You use it on C how to use it in c++
That is a cool stunt 🙂
Brilliant…👌
Great Video!
Great
AWESOME
how can we find the size of a dynamically allocated array?
that was awesome . I got the formula that I was seeking for. thank you very much for sharing this
Thank you so much! I come from a Java background and this was giving me so much trouble in C++.
But if I pass this array as a parameter to some function, then how to calculate its length ?
very good
how about when I pass the array to a function and get the sizeof inside that function, how do I handle such thing that it won't decay, assuming that the parameter only accepts the array?
I see 2 problems with this:
1. what if a is of length 0, won't a[0] seg fault?
2. placing the macro in for loop conditional would make the evaluation at every iteration. (better to do it only once)
i'm sorry, but these formula works with structures too?
Wow, straight!!! Thanks a lot bro!!!
Hi, A bit confused on how your compiler is giving you 48 as sizeof(a); on my pc using the same code i am getting it straight answer e.g 10. Note: ignore my question i was actually using an unsigned char a[] instead of int a[].
what is meaning of
s1=sizeof(*arr); ?
how to find sum of the array elements, if the number of array elements are given at the run time
Thank you!
Thank you! The instruction is very clear!
Why don't you just say sizeof array divide size of element?
So concise and informative. Really amazing job. I'm behind in my C++ class (because I went straight into second semester C++ class without the first semester one), and you, my friend, are going to get me through. Thank you for the vids!
what is "stdafx.h"
Error 1 error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Thanks for this video, just ran into this particular problem not too long ago lol started C++ a week ago, you're a life savor! SUB!!!
i want to measure 2d arry size i tryed but didn't work;
can you tell me how to measure
Mo you'er the man, not only are you a great teacher you are good at what you do; thank you!
But what if I don't know how many elements are going to be in the array?