I knew this guy would be able to teach me pointers.
@michaelsu42532 жыл бұрын
I love your tutorials sooo much. They are clear, thorough and logically smooth! Thank you Mike, it really helps me a lot!
@JovaGoose3 жыл бұрын
Why are you literally better than my teacher who I’m literally paying to teach me??
@camelo0036 жыл бұрын
best aproach i have seen so far. thx!
@HOWDOT6 жыл бұрын
Same here bro :)
@user-gi8lt3tc8n4 жыл бұрын
What an amazing explanation
@SouthernRedneck-pn5pd8 ай бұрын
Pointers are basically references in Java, but C needs to know explicitly that we need to have a pointer (reference), is that why this syntax used? For example in higher level languages like Java, if we instantiate a variable with some value, then declare another variable and assign the first variable, then it is not a copy, the second one holds the reference (pointer?).
@whispymagma25353 жыл бұрын
good job at working hard, I hope one day you get bigger and bigger and hopefully make a dream turn into a reality!
@beneaththefloorboards2 жыл бұрын
Probably not your intent, but you made it dawn on me that a problem I have with programming is I wasn't thinking of the different variable types as things, I was thinking of them as all sort of the same thing with different faces. I guess that sounds sort of weird as I type it, but I think the lack of physical context makes some of these concepts more complicated than they need to be. I'm not 100% sure how to "fix" that issue, but it points the way.
@whisperscribe Жыл бұрын
the best on yt
@kailashnadhgupta13644 жыл бұрын
i have a doubt about this : where exactly are we storing the data when we are using * pVariable ?like are we storing at the same place it was meant to be stored before?
@niteshchaudhari25742 жыл бұрын
The value will be stored in the variable (like 30)... And thre address of that variable is stored in *pVariable
@niteshchaudhari25742 жыл бұрын
Yes it will be stored at its place where it meant to be
@محمدمهدی-س2ط3 жыл бұрын
Great.
@rechillepatosa2673 жыл бұрын
exam namin ngayon, sapian mo ko Kuya Mike.
@niteshchaudhari25742 жыл бұрын
Long live Mike
@daniel520005 жыл бұрын
if a pointer is a variable and it is a memory address, why you keep changing its type from int to double then char.. it doesn't make sense to me. I understand that if you have char x the pointer of it should be char as well.. but why?
@BaltiYoussef5 жыл бұрын
That's exactly what i was going to ask! did you find an answer?
@TurtlesWithAutism5 жыл бұрын
* remains the same for all pointer variables. * defines the pointers.
@travisledo4 жыл бұрын
I believe you have to state the type because of sizes. An int* and a *char requires different amount of memory. And since you are declaring a memory block, it has to know how much memory to put in that block for you. Therefore you cannot just have a standard pointer type without the data type as well. So I think a pointer holds not only the memory hex value but also the size which is why we need to know the type as well.
@mathewkloepfer6644 жыл бұрын
A pointer always holds an integer value in memory. Regardless of the type of pointer or the type of variable it points to, the memory for the pointer always holds a number (memory address of the item you're pointing to). The reason you want the type of the pointer to match the data you're pointing to is for de-referencing. When you de-reference you need to know how many bytes to read in order to get the value stored at the destination memory address. If you de-reference a char pointer you need to read 1 byte. If you de-reference an int pointer you need to read however many bytes an integer is stored as on your architecture (for example: 4 bytes). Edit: You are allowed to specify a void* (which has no type) as well. This is a dangerous, yet powerful tool where you can read blocks of memory back as any type you want by casting the pointer to the type you want. (YOU CANNOT DEREFERENCE A VOID POINTER ON ITS OWN) i.e. int age = 0x00000041; (you can assign hex values to integers as well) void *p = &age; (use void pointer for address of age) char *x = (char*)p; (cast the void pointer into a char pointer and assign it to x) printf(" %c ", *x); (print the value stored in the memory address of where x points to) On my PC, this prints the letter 'A' because the original 4 bytes of memory created for the int are still there, but the cast into a character pointer will only read a single byte of memory when dereferenced in the print call. The value 65 (41 Hex) is 'A' in ASCII - which is why it is printed.
@harshilkotamreddy4 жыл бұрын
@@mathewkloepfer664 Great explanation, thank you.
@Avolua Жыл бұрын
Great content, great everything, but I think you repeat yourself too much. Just saying