Arrow Operator For Pointers To Structs | C Programming Tutorial

  Рет қаралды 39,718

Portfolio Courses

Portfolio Courses

Күн бұрын

How to use the arrow operator in C to access the member variables of a struct when we have a pointer to the struct. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!

Пікірлер: 51
@CoolModderJaydonX
@CoolModderJaydonX 3 ай бұрын
Keep in mind, when using malloc on something, use free to free the allocated memory when you no longer need it.
@iwannapressit6886
@iwannapressit6886 Жыл бұрын
thank you showing both ways to point to something!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're very welcome! :-)
@thesuperiorman8342
@thesuperiorman8342 Жыл бұрын
Thank you so much. Well presented and to the point 👍
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You’re very welcome, I’m glad you enjoyed it! :-)
@abdulsametaybaz3321
@abdulsametaybaz3321 Жыл бұрын
Thanks your explaining and speaking so clear I can understand easily
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome Abdulsamet! :-)
@pixelgamesSARLS
@pixelgamesSARLS 4 ай бұрын
So well explained! Thank you
@mr.luxxyandreneo5168
@mr.luxxyandreneo5168 Жыл бұрын
Nice explanation
@PortfolioCourses
@PortfolioCourses Жыл бұрын
I’m glad you enjoyed the explanation! :-)
@LexElls
@LexElls 2 жыл бұрын
Thanks for supplying the code! That's awesome
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You're welcome Lex! :-D
@elisha502
@elisha502 Жыл бұрын
if im using an arrow how do i scan into those varibale?
@ratdude010
@ratdude010 8 ай бұрын
Magic, you need to call Harry Potter. I'm actually wondering the same thing.
@mementomori7160
@mementomori7160 7 ай бұрын
I know it's old but, why can't the compiler jsut dereference the pointer first? Do you know if there is a reson for that? That way they wouldn't need a completely new operator to exist
@ladyville3
@ladyville3 7 ай бұрын
It would do it all the time, even when you don’t want it to?
@jeremykhoo5127
@jeremykhoo5127 5 ай бұрын
Sometimes you want to change the address of the pointer and not the value You have an address to a John's house. Set to Mary A postman subroutine has a pointers to "delivery for" it is set at adress: John's house Person: Marry So it means you will go to John's house and deliver the package to Mary who lives there If you always dereference that means you can only deliver to the people in John's house (Mary and John). You cannot deliver to anyone in Clements' house ie you can only change the value, you cannot change the address
@dimpe5038
@dimpe5038 Жыл бұрын
Really nice explanation, thanks!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You’re welcome, I’m glad you enjoyed the explanation! :-)
@zattirizortzort486
@zattirizortzort486 Жыл бұрын
Very well explained. Thanks
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You’re welcome Ulas, I’m glad you enjoyed the explanation! :-)
@michasmykowski5753
@michasmykowski5753 5 ай бұрын
Thanks man You really made my day
@erennkose
@erennkose Жыл бұрын
Thanks for these videos i hope i can pass my exams.
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome Aaron, and good luck on your exams! :-)
@FELIPEGABRIELMARQUESDOSSANTOS
@FELIPEGABRIELMARQUESDOSSANTOS 7 ай бұрын
thanks man. I finally get it 😅
@avixx
@avixx 6 ай бұрын
Love this!
@marbles5590
@marbles5590 Жыл бұрын
Thank you for this video... although I had problems in my code. It says 'cannot convert int* to Point'. I don't have any problems using the arrow operator and such, only this (*p3), p3-> thing after dynamically allocating using malloc().
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome! :-) And I'm not sure why that would be without seeing the code, can you maybe post your code in a comment here so I can look at it? I've posted the code in this video here: github.com/portfoliocourses/c-example-code/blob/main/arrow_operator.c.
@marbles5590
@marbles5590 Жыл бұрын
@@PortfolioCourses hello, I used another IDE and the code works. My code is just the same as yours. Maybe this error has something to do with my settings...
@Quasarsoft
@Quasarsoft Жыл бұрын
​@@marbles5590 I suppose you are using c++ compiler . You need to change your main.cpp to main.c
@marbles5590
@marbles5590 Жыл бұрын
@@Quasarsoft ty for that but i have already solved the prob months ago. Still there are times i get used to using the devc++ compiler and forgot to change it to .c 😅
@hicg
@hicg Жыл бұрын
hello from Brasil. thanks!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome! :-) And hello from Canada!
@radomeditv
@radomeditv Жыл бұрын
clear in very helpful
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Awesome, I’m glad to hear that! :-)
@ionguzun3952
@ionguzun3952 2 жыл бұрын
Thank you!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You’re welcome Ion! :-)
@aravinthr607
@aravinthr607 Жыл бұрын
Thank you sir ...
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome! :-)
@iuseyoutubealot
@iuseyoutubealot Жыл бұрын
what text editor r u using
@PortfolioCourses
@PortfolioCourses Жыл бұрын
In this video I am using Xcode on a Mac. 🙂
@awekeningbro1207
@awekeningbro1207 8 ай бұрын
when we use char data types for this, it doesnt work.
@SameerAhmed-wf8yf
@SameerAhmed-wf8yf 5 ай бұрын
which IDE are you using?
@pirasannanmusicals
@pirasannanmusicals Ай бұрын
what text editor u r using
@sagartalole15
@sagartalole15 Ай бұрын
X code on mac
@joaco.
@joaco. Жыл бұрын
You are godlike.
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Aww haha thank you very much for the support. :-)
@hakant.5806
@hakant.5806 8 ай бұрын
👍
@PortfolioCourses
@PortfolioCourses 8 ай бұрын
Thanks! :-)
goto Statements | C Programming Tutorial
4:46
Portfolio Courses
Рет қаралды 16 М.
struct Basics | C Programming Tutorial
24:44
Portfolio Courses
Рет қаралды 138 М.
My daughter is creative when it comes to eating food #funny #comedy #cute #baby#smart girl
00:17
when you have plan B 😂
00:11
Andrey Grechka
Рет қаралды 60 МЛН
String In Char Array VS. Pointer To String Literal | C Programming Tutorial
9:58
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 306 М.
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,2 МЛН
int *p vs int* p Pointer Declarations | C Programming Tutorial
6:12
Portfolio Courses
Рет қаралды 136 М.
Reading/Writing structs to files (aka Serialization)
14:41
CodeVault
Рет қаралды 75 М.
Pass By Reference | C Programming Tutorial
10:12
Portfolio Courses
Рет қаралды 35 М.
How To Return An Array From A Function | C Programming Tutorial
13:01
Portfolio Courses
Рет қаралды 66 М.
why do void* pointers even exist?
8:17
Low Level Learning
Рет қаралды 362 М.
When to use the Arrow Operator in C and C++
5:43
Jacob Sorber
Рет қаралды 37 М.
Function Pointers | C Programming Tutorial
18:31
Portfolio Courses
Рет қаралды 61 М.