General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Toby
Low Level
comments
Comments by "Toby" (@toby9999) on "why do void* pointers even exist?" video.
Yeah, that's generally not a good idea. A pointer should be initialised to memory or the address of an object such as an int variable, etc..
2
To deal with memory addresses. C was very broadly speaking and conceptually a higher level assembler. The next step up in a way. Memory address are fundamental in assembly language because we're dealing with the cpu and other hardware items directly, hence memory addresses in assembly and pointers in C.
2
The heap manager or whatever the implementation uses will store that information during the allocation in something like a header area.
2
That information is typically stored as overhead in a header area or some such. Could be implementation specific. It's 15 years since I had to deal with that stuff but yes, the system knows how much memory was allocated for each.
2
What you said about %d is correct, but in this example, he is not printing a pointer anyway.
1
Not really.
1
C is a language designed to get close to the hardware level. Memory addresses are effectively void* on the CPU. It makes sense. For those who want a higher level abstraction, C is the wrong tool.
1
That would be a useless video.
1
Strictly speaking it's not part of the type per se. The declaration consists of two components conceptually... e.g. int x,*y; The 'int' declares the data storage type to be 'int'. The * says y is a ponter.
1
A memory address with no type.
1
Unlike C++, the C language does not provide for pass by reference. In order to have a function modify an object or variable passed in (such as person), one has to pass a pointer. That pointer will be dereferenced by the function with operator -> The other reason for passing a pointer would be for efficiency.
1