C Programming Tutorial – 16 – Typecasting

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Comments

Joe Pearson says:

I am learning C# at college, but i feel like web development isn#t wheere i want to be. I am learnign C and then C++ what areas of programming could this open up?

Ben Tulchinski says:

It’s so cool to see how you have changed since the Java tutorials XD

kushal parikh says:

I just try to register on your website but did not get confirmation mail.

piyush singh says:

i cannot see anything on the video, the font is too small, ccontent is good but presentation (visual) is not, u cud improve on presentation by increasing the font size

Nahid Enam says:

thanks man

Harsh Mishra says:

If I wanted to include a file in main.c which contain programming codes similar to main.c then Can I? If yes then How?

james brown says:

i’m here now!! Yippee~~ i love bucky tutorial 

Sazid Al mubeen says:

can you upload some android version?

Oguz Akkas says:

just one casting is enough actually:
 avgProfit = (float)priceOfPunpkin * sales / dayWorked;
 gives same result

Jason Heard says:

// Thank you!

USS Trekky says:

Good example

le00 says:

what are floats?

kuntal shah says:

@thenewboston
I can not find your tutorial codes on your website : https://thenewboston.com/
Did you move it to somewhere else?

Daski69 says:

can you write:

(float)((priceOfPumpkin * sales) / daysWorked)???

thanks!

Pedro Marin says:

thanks for the videos… i like my professor but problem with professors is they forgot to be students.. thanks bro

Shohan Rahman says:

Is there any reason for me to not declare ALL numerical variables as float?
I mean, since cross-compatibility is an issue, why bother using the less accurate int in the first place?

Daniel Samuel says:

Anybody know why when you change the currency sign say to a pound sign or a euro sign they don’t show up?

Habib says:

how old are you now Bucky?

Alba MK says:

Is it possible to convert a char variable into an int? I am thinking in the case that we want to know, for example, the amount of characters that a word contains. I am sorry, I just began learning how to program, sorry if it is a stupid question but I don’t know if you can do this.

Tarun Yadav says:

Sir ,
 I have one question what to do to remember the code for a long time ?
         I forget code after two days of learning .
      Please help me and Answer my Question .
                                                   THANK YOU !!!

Vincent says:

When I enter decimal number doesn’t work

Videozz says:

Love your tutorials  Man i couldn’t find for loop while loop and do while loop.???

John Phenex says:

umm not to be a smartass, but profit is after you subtract the expenses, well nvm that tho, nc video thanks. I’m just starting to study programming and I’m glad i found your site.

Ace Cristopher Cenabre Malabuyo says:

I was wondering can make a donut shop with c language with all of the orders and drinks also the combo meals cause im really confused and also tnx for the tip for the float

Ashish Kushwaha says:

Nice pumpkin story BTW.

Hussain Moh says:

Thanx man … I’m really get benefit from these videos

Thank u  Thank u   Thank u 

Tatrasiel says:

I am guessing that to be Buddy Blackbird?

Youtube Käyttäjä says:

0:31 thats like me reading a new message.. “Probably just mom again.. wow actually not cool who is it”.

Stephen John says:

Cracker Barrel is the best!

Emmanuel Chinzaje says:

The main reason why you get 84 is because the program rejects all the decimal values since you’re working integers. The point is the compiler does not output 84.25… because you declared your avgProfit as a float. If you declare it as a double and print it with “%lf” (low float) it will work and you will get 6 decimal figures!

Chanz Holopainen says:

If 59 *10/ 7 = 84, Then 84*7/10 should be equal to 59 Right? But it’s not (in C). its 58.8

Check it out by running this:
#include
#include
int main(int argc, char const *argv[])
{
printf(“%f n”, 59.0/7*10);
printf(“%f n”, 84.0*7/10);
return 0;
}
___________
Output:
    84.285714 
    58.800000 

I think Microsoft is correct. something wrong with the code. C is rounding numbers for us. anyone have any idea?

cashews fordays says:

why do they have integers and floats, why not just floats?

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours