Void Pointers | C Programming Tutorial

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

You honestly have a gift for teaching this stuff. Typecasting is an obtuse topic at times and a typecast pointer is very obtuse. I've never really understood them and how they are used, until now.

StreuB
Автор

when it's great, it is always great and always will be. The pointers were my roadblock until now, but things have become smoother and I can follow without fear. Thanks, Kevin, for the great effort which is priceless.

naboulsikhalid
Автор

Another complex topic explained simply. Thank you for all your teachings. Your teaching style is top tier

siya.abc
Автор

I found ur videos about c and u are an absolute genius in explaining things! Thank u so much for ur content!

tracetv
Автор

holy crap not to be weird but im high and i was literally just wondering about void pointers and your video just came out so this is great!! thank you!!

also your tutorials are so helpful. i greatly value the knowledge you impart.

Lichen
Автор

Awesome tutorial! 😃
To be even less ambiguous I always prefer to attach the star to the type, I mean:
int* p = &a
instead of
int *p =&a.
This way in my opinion it’s very clear that the variable type is “int pointer”. And this way also you make a clear difference between the way you declare a pointer variable and the way you deference a pointer variable. Which I often noticed leads to some initial confusion at the early stages of understanding pointers.

GianlucaSibaldi
Автор

Extensive explanation about this topic, Thanks Kevin.

justcurious
Автор

To me the whole thing with pointers devolves to simply memory access. A type pointer will read the memory address depending on the type(int* will read 4 bytes and will decode the bits as int). A void pointer is a typeless pointer, it holds a memory address but does not know what is there. I think the fact that all pointers(regardless of type) are of the same size was a big eye opener to me.

That being said, when we are moving the void pointer via pointer arithmetic, then the movement acts like that of the char* where each move is done in 1 byte * n . A type pointer will move depending on it's type, like a int* will move 4 bytes.

Thus recently I wondered if there is any benefit to a void pointer since it acts like a char*. Of course one of the benefits is that it's typeless and thus can be a pointer to any type. Making it more universal.

NikolaNevenov
Автор

Would you mind making a playlist on all the pointer videos you've done so I can follow them chronologically?

parosdelos
Автор

Again, great video!

I see the void pointer as a multi-type pointer with some restrictions.

When I 'malloc' memory, I use the data type(s) to format the memory to the desired type in pedagogical way.

grimvian
Автор

I did understand pretty well this thing about pointers... but I was wondering why the heck the function `qsort` you show in the video takes a pointer parameter which type is void*? `qsort` is gonna iterate over each contiguos address of the array, but how will it do that if the pointer type is void* which doesn't accept arithmetic operations?

Joao-ooyj
Автор

I was curious if you will mention that pointer arithmetic on void pointers is illegal according to ISO C. You did mention it!
Excellent tutorial! Thank you so much!

If we don't need a cast after malloc in C, can we use the following syntax to keep the instruction more generic?

int* ptr = malloc(n * sizeof(*ptr));

(No need to adjust the right side of the assignment if the pointer type of "ptr" should change).

Is this legal according to ISO C?
Would you do it the same way professor?
Thank you very much!

starcw
Автор

Is it fair to say that, when you “p is pointing to a memory address if any type of data” for void *p that we could also say: “p is pointing to a memory address that can hold a data type of any size”? If I am thinking of a memory address (size depending on the hardware if course) then it is a series of bits that are either high or low…and the data type tells us (in addition to helping write correct programs) how many bits we can store there? or am I taking my microcontroller class (in assembly) too seriously? 😅

wlcrutch
Автор

If I saw *((char *)p) before, I'd definitely freak out! Thanks for your videos, this is no longer the case.

eugenebespalov
Автор

Thank you so much for great explanation

goktugparlak
Автор

please could you do an example using _Generic keyword??

otaxhu
Автор

hi can you make a video about serial communication in c?

ozkanakbas
Автор

Saw a video of something similiar to manipulate floats, i think it was indirection or something… like this:
float a;
uint32_t temp = *(uint32_t*)&a;
then manipulate the bits on the float and cast (float*) on it again

yoruichi
Автор

i just wanna pack as much data as closely as possible :P

ni.ko
Автор

12:22 - Chinese spy injecting subliminal messaging confirmed! But on the real, what IDE are you using for these tutorials?

Jarred-ykhq
visit shbcf.ru