Pointers | C | Tutorial 27

  Рет қаралды 16,372

Giraffe Academy

Giraffe Academy

Күн бұрын

Пікірлер: 26
@gabehcuodsuoitneterp203
@gabehcuodsuoitneterp203 3 жыл бұрын
I knew this guy would be able to teach me pointers.
@michaelsu4253
@michaelsu4253 2 жыл бұрын
I love your tutorials sooo much. They are clear, thorough and logically smooth! Thank you Mike, it really helps me a lot!
@JovaGoose
@JovaGoose 3 жыл бұрын
Why are you literally better than my teacher who I’m literally paying to teach me??
@camelo003
@camelo003 6 жыл бұрын
best aproach i have seen so far. thx!
@HOWDOT
@HOWDOT 6 жыл бұрын
Same here bro :)
@user-gi8lt3tc8n
@user-gi8lt3tc8n 4 жыл бұрын
What an amazing explanation
@SouthernRedneck-pn5pd
@SouthernRedneck-pn5pd 8 ай бұрын
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?).
@whispymagma2535
@whispymagma2535 3 жыл бұрын
good job at working hard, I hope one day you get bigger and bigger and hopefully make a dream turn into a reality!
@beneaththefloorboards
@beneaththefloorboards 2 жыл бұрын
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
@whisperscribe Жыл бұрын
the best on yt
@kailashnadhgupta1364
@kailashnadhgupta1364 4 жыл бұрын
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?
@niteshchaudhari2574
@niteshchaudhari2574 2 жыл бұрын
The value will be stored in the variable (like 30)... And thre address of that variable is stored in *pVariable
@niteshchaudhari2574
@niteshchaudhari2574 2 жыл бұрын
Yes it will be stored at its place where it meant to be
@محمدمهدی-س2ط
@محمدمهدی-س2ط 3 жыл бұрын
Great.
@rechillepatosa267
@rechillepatosa267 3 жыл бұрын
exam namin ngayon, sapian mo ko Kuya Mike.
@niteshchaudhari2574
@niteshchaudhari2574 2 жыл бұрын
Long live Mike
@daniel52000
@daniel52000 5 жыл бұрын
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?
@BaltiYoussef
@BaltiYoussef 5 жыл бұрын
That's exactly what i was going to ask! did you find an answer?
@TurtlesWithAutism
@TurtlesWithAutism 5 жыл бұрын
* remains the same for all pointer variables. * defines the pointers.
@travisledo
@travisledo 4 жыл бұрын
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.
@mathewkloepfer664
@mathewkloepfer664 4 жыл бұрын
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.
@harshilkotamreddy
@harshilkotamreddy 4 жыл бұрын
@@mathewkloepfer664 Great explanation, thank you.
@Avolua
@Avolua Жыл бұрын
Great content, great everything, but I think you repeat yourself too much. Just saying
@wilmerkluever7379
@wilmerkluever7379 2 жыл бұрын
* is not an astrix. its a fukin asterisk.
Dereferencing Pointers | C | Tutorial 28
5:16
Giraffe Academy
Рет қаралды 18 М.
Writing Files | C | Tutorial 29
9:35
Giraffe Academy
Рет қаралды 22 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Building a Guessing Game | Tutorial 23
12:43
Giraffe Academy
Рет қаралды 10 М.
Arrays | C | Tutorial 15
10:34
Giraffe Academy
Рет қаралды 18 М.
Pointers in C
10:09
Gary Explains
Рет қаралды 257 М.
If Statements | C | Tutorial 18
14:10
Giraffe Academy
Рет қаралды 11 М.
2D Arrays & Nested Loops | C | Tutorial 25
10:26
Giraffe Academy
Рет қаралды 17 М.
Functions | C | Tutorial 16
9:14
Giraffe Academy
Рет қаралды 21 М.
Data Types | C | Tutorial 7
6:28
Giraffe Academy
Рет қаралды 17 М.
Building a Mad Libs Game | C | Tutorial 14
9:07
Giraffe Academy
Рет қаралды 12 М.
While Loops | C | Tutorial 22
8:25
Giraffe Academy
Рет қаралды 10 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН