C Programming Tutorial - 14 - Calculating the Average Age

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

dude....using this to study for finals tomorrow, hilarious. love it

wheatsquares
Автор

42 isn't that old for a kindergarden student though, who knows

harshpherwani
Автор

finally I can do something interactive, thank you!

ibogdan
Автор

Always remember with a language such as C - less is more.

veronaswindall
Автор

I was about to object to two "kindergarteners" being 4 years old, but then you wrote 42 and... Yeah, whatever. Shine on you crazy diamond.

SevenDayGaming
Автор

Anyone in 2020 watching these awesome videos while in quarantine to feel they're not wasting time

h.harris
Автор

char Name [20];
Printf("what is your name?\n");
scanf(%s, Name );
printf("%s love this video!!!!\a ", Name);
return 0;

yichengwang
Автор

Just a bit of beef with how you explained assigning the same values to multiple variables... its not that the compiler is "looking right to left" and that b is equal to c... its that the statement c = 3 *returns* 3. Assignments return the assignee.

a = b = c = 3;

is just short hand for

a = (b = (c = 3));

That's how its actually being processed. Each variable gets the result (or the return) of the assignment ahead of it.

Perhaps a clearer example:

int a;

printf("%d", (a = 3));


>>3
The above prints out 3... but certainly not because its trying to access the variable a. It's printing out the result of that assignment.

This may seem like splitting hairs, but I think it's actually pretty important that people new to the language understand what the compiler is doing and why. Knowing that assignments return the assignee is useful, and thinking that a = b = c = 3 is actually referencing those address spaces to inform each variable is misleading and confusing, and goes against how we should expect the compiler to operate.

Cheers.

isaiahtaylor
Автор

let's go ahead and run this bad boy!

tvhotmilk
Автор

I don't understand why there is no '&' sign before the float average. We learned that we need a & sign for everything except arrays right? Is average considered an array here? Even if we used %f?? Thank you I am a bit confused

eircqwert
Автор

lets say you changed the value of age2 in line 8 (age2=5;) would that affect the value age1 or not? i mean because of the way you assigned their values in line 7..

yiannisapollong
Автор

In that function with the ages, how do you make a sort of "security" that people enter floats (or in my case integers) in the input? So it will print out a line like if it's not an float (or in my case an int): printf("please enter a number") or smth like this

broefkip
Автор

hi bucky, thanks for the lessons.
i have a question .
what i don't understand is why do we use a float value for scanf if when the age entered is going to be an integer??it got me a bit confused, thanks

amaypagrut
Автор

am i the only person who watch these tutorials? 1/5/2020

unlkc
Автор

what if the question was make program to find the average of a set of numbers ..and didnt tell us how many elements ..plz i need answer soon .. like how to tell the user to enter the elements while i dont know how many are they ..!!

abby
Автор

Do I have to learn these codes, I am able to do it only with assistance of bucky, how will I be able to code myself?

abhimanyuthapliyal
Автор

sir can you help me for the formula of motorcycle loan?? the interest.monthly.price of the motorcyle how can i code it sir?? it so confusing for me.

markabelardo
Автор

It's okay to do that, right?   
int age1, age2, age3;
float average;

youtube_veteran
Автор

how come we do not use &average? how come we don't need the ampersand in front of average? even though it is not an array.

sukaki
Автор

-Another pro-tip:-

-int a, b, c;-

-a = b = c = 100;-

-That works, instead of having int written out 3 times.-


I spoke too soon.

buxt-tech