Тёмный

Function Basics | C Programming Tutorial 

Portfolio Courses
Подписаться 191 тыс.
Просмотров 62 тыс.
50% 1

An overview of the basics of using functions in C. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

Хобби

Опубликовано:

 

7 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 63   
@jacobpark9334
@jacobpark9334 2 месяца назад
A dude that knows how to explain at the perfect pace and thoroughly, thanks!
@PortfolioCourses
@PortfolioCourses 2 месяца назад
You’re welcome, I’m glad you enjoyed the explanation! :-)
@dorsia6938
@dorsia6938 Год назад
Great video, I love the fact you take the time to explain the core functionality behind things, metioning relationships and comparisons between other things we've already learned, instead of just glossing over code.
@PortfolioCourses
@PortfolioCourses Год назад
Thank you very much for the positive feedback, I'm really glad to hear that you enjoyed the "style" of the video. :-)
@robertmaina337
@robertmaina337 Год назад
True.... His way of teaching is superb..... I feel like a great programmer every time I watch this videos.... Thank you @portfolio courses...
@PortfolioCourses
@PortfolioCourses Год назад
@@robertmaina337 You're welcome Robert! 😀
@ajaykumarmajhi6206
@ajaykumarmajhi6206 Год назад
Ķm
@kylemlsantos97
@kylemlsantos97 Год назад
Thank you for helping visual learners! Your content is valued and appreciated
@PortfolioCourses
@PortfolioCourses Год назад
You're very welcome, I'm glad you're enjoying the content! :-)
@lenoracollins9225
@lenoracollins9225 Год назад
Thank you very much. It's one thing to read and understand a book, but it's also very easy to lose your way when implementing those concepts from a book. This put me back on track, and now I understand why I am making mistakes with my functions.
@PortfolioCourses
@PortfolioCourses Год назад
You're very welcome Lenora, I'm glad this video was able to help you out! :-)
@902Steeler
@902Steeler Год назад
You cleared up alot of unknowns for me here. Thank you
@PortfolioCourses
@PortfolioCourses Год назад
I'm glad it cleared things up for you Phil, and you're welcome! :-)
@efekucukyeter9574
@efekucukyeter9574 Год назад
The compiler joke got me. Thank you for the explanation.
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome! 🙂
@EfthimiaAthan
@EfthimiaAthan Год назад
Thank you! Very well explained.
@PortfolioCourses
@PortfolioCourses Год назад
You’re welcome Efthimia! :-)
@dasura9147
@dasura9147 Год назад
Nice video! also very helpful that you share the code you used in the video :)
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome! :-)
@zodack8477
@zodack8477 10 месяцев назад
Can we actually call out mult() function inefficient, if eventually the compiler produces assembly code that multiplies by addition for all high-level multiplications?
@omniyambot9876
@omniyambot9876 2 месяца назад
the super inefficient multiplication is funny but definitely learned😂
@animeworldamv5052
@animeworldamv5052 2 месяца назад
Your so great at explaining thank u so much, new subscriber
@PortfolioCourses
@PortfolioCourses 2 месяца назад
You’re welcome, I’m glad you enjoyed it, and welcome aboard! :-)
@TheHset
@TheHset Год назад
Great video!
@PortfolioCourses
@PortfolioCourses Год назад
Thank you, I'm glad you enjoyed it! :-)
@hadichaahmadjonova
@hadichaahmadjonova Год назад
Hi could you make a tutorial video how you installed gcc on mac and how you use it on terminal i am really having problem with it please.
@pappisedi
@pappisedi Год назад
this is so helpful
@saiidramadan4055
@saiidramadan4055 2 года назад
Thanks for the video
@PortfolioCourses
@PortfolioCourses 2 года назад
You're welcome! :-D
@jeremytay7658
@jeremytay7658 Год назад
Hi, thanks for the video, may I know why is there a "0" in "return 0" and "int result = 0"? What does the 0 mean? Is there any other video I can see to find out why?
@PortfolioCourses
@PortfolioCourses Год назад
Great question Jeremy! :-) This video explains the main function return values: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-CBfhcRQVpf8.html. In the "mult" function in this video, we start result off at zero with int result = 0, but then use the add function to continually add y to the result, before finally returning the result.
@razankanji5088
@razankanji5088 Год назад
helpful video thank u so much
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome Razan, I'm glad you found the video helpful! :-)
@Lizini
@Lizini Год назад
Good video!
@PortfolioCourses
@PortfolioCourses Год назад
Thank you! :-)
@dimasaditya4034
@dimasaditya4034 8 месяцев назад
why do we need to return value sir?
@intanshari152
@intanshari152 Год назад
What if the parameter has 2 different data type? can float and integer be in a same parameter? example- convert(int a, float b);
@PortfolioCourses
@PortfolioCourses Год назад
Great question, and yes, that is allowed. :-)
@rekt5262
@rekt5262 Год назад
that fun fact i discoverd is when i use for() with its brackets " {} " u must replace that return out of the loop ---> for(){} return result;
@PortfolioCourses
@PortfolioCourses Год назад
Good you learned something new! :-)
@mareknovak1147
@mareknovak1147 Год назад
Why do we need function declaration if we can just express the whole function before the main function? I don´t understand
@PortfolioCourses
@PortfolioCourses Год назад
Great question Marek! :-) You could technically put the whole function definition before main and it will work. You could do this if you had multiple functions as well. But then if you have many functions defined, you would need to either scroll through or read through them before finding the main function. If we use function prototypes, when reading our file from top to bottom, at the top of are file we are made aware of the functions that will be defined, and then we would next see the main function. From a readability perspective, this is generally going to be much easier for a programmer to read and understand. :-)
@mareknovak1147
@mareknovak1147 Год назад
@@PortfolioCourses thanks a lot, much clearer now
@PortfolioCourses
@PortfolioCourses Год назад
@@mareknovak1147 You're welcome! 😀
@yehah
@yehah Год назад
Hello, you mentioned the variable result cannot the be used outside of the add function. It appears again in mult however. Is the program/compiler going to know both result variables are different even though they appear in two functions? Thank you
@PortfolioCourses
@PortfolioCourses Год назад
Great question! :-) So even though they have the same name, those are two different variables called result, each belonging to a different function (the “scope” of the variables). This video covers variable scope in more detail: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-IVJoByfBcZs.html
@eyezyc1723
@eyezyc1723 Год назад
I was a bit lost in the function calling other functions example... I couldn't get how you did the multiplication... 😔
@PortfolioCourses
@PortfolioCourses Год назад
These can be pretty tricky concepts unfortunately! But basically if we have something like 4 x 7 = 28, we can think of it as 7 + 7 + 7 +7 = 28. In other words, adding four 7 values together. So we have an add() function that will return the result of adding a and b, so if we pass it add(0,7) it will return 7. If we pass it add(7,7) it will return 14. If we pass it add(14,7) it will return 21. And if we pass it add(21,7) it will return 28. Our mult() function performs the multiplication by repeatedly calling add 'x' number of times using the loop, just like that example above, with add(result,y), where y is the right operand of our multiplication x * y with mult(x,y). And the function starts off result at 0, and calls add with add(result,y) each time, but it stores the value returned by the call to add back into result. So if the first time result is 0 then we'll call add(0,7) and it's going to return 7 (which gets stored into result). And the NEXT time we call add we'll have add(7,7) which is going to return 14 (which again gets stored into result). And then we call add(14,7) and get 21, and then again with add(21,7) to get 28. And at that point we'll have done the x=4 adds, and the loop will stop, and the function returns the result. Hopefully this helps somewhat! :-)
@eyezyc1723
@eyezyc1723 Год назад
This was helpful sir.. I really appreciate.. for the fact that you respond to every message that comes in the comment section is something to appreciate.. thank you sir
@PortfolioCourses
@PortfolioCourses Год назад
@@eyezyc1723 You're welcome! 🙂
@thegospelmessages8730
@thegospelmessages8730 Год назад
I don't understand why u used a for loop with 'i' when u did not declare 'i' as a variable.. or is it another way of declaring a variable 'i'?????
@PortfolioCourses
@PortfolioCourses Год назад
Great question! 🙂 So we declare i in the for loop itself with: for (int i = 0; i < x; i++) result = add(result, y); Specifically where it says "int i = 0;". This is another way of declaring a variable. The variable i will have the "scope" of the for loop, which means the variable will "exist" inside the for loop only.
@rekt5262
@rekt5262 Год назад
@@PortfolioCourses that question of the boi jumped into my mind and i was like no way its gonna work until i saw that i = 0 xdd , was a relly fun short story . u earned my sub
@PortfolioCourses
@PortfolioCourses Год назад
@@rekt5262 Welcome aboard! 🙂
@aabirraghib8826
@aabirraghib8826 Год назад
even if u dont write return result; the output is showing me as 9..didnt get wht return is used fr ?
@PortfolioCourses
@PortfolioCourses Год назад
I would have to see your code to know what's going on there. :-) Maybe you can paste it in as a comment? In order to return a value from a function the regular way, we do need to use a return statement of some kind.
@aabirraghib8826
@aabirraghib8826 Год назад
@@PortfolioCourses man if u gt a chance not to use a return keyword,thn hw would u write the code in generic terms
@aabirraghib8826
@aabirraghib8826 Год назад
@@PortfolioCourses k
@aabirraghib8826
@aabirraghib8826 Год назад
@@PortfolioCourses check the code=i removed return keyword bt the result is still getting printed #include int main() { int fun1(int s1,int s2){ int s3=s1+s2; } int output=fun1(5,12); printf("the result is: %d ", output); }
@my_evil_side2977
@my_evil_side2977 9 месяцев назад
7:00 important point that your college professors won't explain every .
@alinadiaz-by1zn
@alinadiaz-by1zn 4 месяца назад
I love you
@abderrahmanezerouali735
@abderrahmanezerouali735 11 месяцев назад
i really like your explaintion, i'm not good in english but i wanna say thank you sir 🤍
@PortfolioCourses
@PortfolioCourses 11 месяцев назад
I’m glad you enjoyed the explanation, and you’re very welcome! :-)
Далее
Array Basics | C Programming Tutorial
13:37
Просмотров 35 тыс.
#15  C Functions | C Programming for Beginners
17:21
Просмотров 195 тыс.
Frank Now VS Then Edit 🥵| #brawlstars #shorts
00:18
Просмотров 767 тыс.
Gặp 2 thánh troll | CHANG DORY | ometv
00:42
Просмотров 24 млн
Все кругом Миланы... 🤣
00:12
Просмотров 213 тыс.
strtok() function | C Programming Tutorial
12:36
Просмотров 58 тыс.
C function prototypes 🤖
4:37
Просмотров 46 тыс.
struct Basics | C Programming Tutorial
24:44
Просмотров 131 тыс.
Programming with Math | The Lambda Calculus
21:48
Просмотров 131 тыс.
why are switch statements so HECKIN fast?
11:03
Просмотров 389 тыс.
My 10 “Clean” Code Principles (Start These Now)
15:12
Use Arc Instead of Vec
15:21
Просмотров 138 тыс.
Quando ACELERA eu faço MAIS GRANA 💰
0:16
Просмотров 79 млн
Прошёл босиком 3600 метров
0:59
Просмотров 1,3 млн