C Programming Tutorial 13 - C Basics Part 5 - Basic Type Casting

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

Hi Caleb. I am a teacher but I have great respect for the way you explain the things. This is a great tutorial for learning the C programming language. And for those who like to learn some more computer science: take a look at Caleb's tutorials on database design.
If you ever lose your job you can apply for a job at my school. If you want to move to *The Netherlands*, a beautiful country in Europe.

MarcelRoesink
Автор

Really nice way of explaining this, thanks Caleb!

benwinstanleymusic
Автор

Fantastic explanations; thanks for showing how to fix common mistakes too. It really helps with the overall learning process!

nickolashoover
Автор

Your tutorials are incredibly well explained and super helpful! Thank you for that :D

hype_flp
Автор

Hey, thanks for the series. I was kinda struggling with the concepts of classes and objects until i saw your series on C#. Very informative. Now I'm taking the C course and it's been great. Keep up the great work

flirtyemy
Автор

I've learnt it all from here. WOW

mukamaisaac
Автор

Thank you for making this so basic and understandable!

danielwarzecha
Автор

%lf if you don't want an error when scanning a double vs a float

spencernold
Автор

You are amazing sir .. btw how i will able to learn various languages as this c is my initial language

gilttcn
Автор

Nice explanation bro. Auto subscribe. :)

yudiaditya
Автор

Casting? More like blasting...us with knowledge! Thanks again for making this amazing tutorial series.

PunmasterSTP
Автор

Nice video easy to understand. Tho im having difficulties. Im trying to use scan with 2 user inputs and compare the numbers. Any help? Thanks

flipinfin
Автор

2:04 it's not necessary to use a double type for dozens, because you either have a dozen or you don't. I mean, the code is right, but I have never seen anyone buying 2.33 dozens of eggs.

jorgev.zertuche-rodriguez
Автор

The jokes and giggles after are what keeps me from leaving comsci lol

yotap
Автор

Dear Caleb
Thank you for your forensic explanations.
I understand the logic behind tute 13 - Basic Type Casting
Using the same logic why won't setting the user's input to a double data type not work?
This example won't work. Why not?

Thank you and very grateful for your hard work.
Drew

//To calculate the number of eggs to the nearest dozen
#include <stdio.h>

int main()
{ printf("The number of eggs for the day is: ");

double eggs;
scanf("%f", &eggs);

double dozen = eggs / 12.0;

printf("You have %f dozen eggs.\n", dozen);

return 0;
}

sallydrew
Автор

Same thing.Can somebody please explain ho to make program which can take decimal numbers not only whole numbers.Thank you.Videos are good.No doubt

Товарищприбалт
Автор

why not just double eggs instead of int?

bamfme
Автор

so i changed "int eggs" to "double eggs" and the %i to a %f, i got a warning on compilation, but upon entering 18 eggs i still got the answer of 1.5, is this an incorrect way of doing things? changing the integer of eggs to a double, so its no longer an int * int and the answer can be a decimal?

sportbikeguy
Автор

you could also just do eggs/12.0 then you automagically have eggs casted to double, right?

eggs/12.0f should do it for floats. Excuse fail questions I come from java and am pretty nooby C/C++ programmer yet

multigladiator
Автор

😅why can't we simply change the int eggs to double eggs ???

rajasri.p