C Programming Tutorial # 17 - More on Arrays - Part 2 [HD]

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

This tutorial continues to cover arrays in more detail. In this tutorial we write a small program that demonstrates the creation and use of arrays.

This tutorial is part of the following series:
Рекомендации по теме
Комментарии
Автор

greate for teaching and more clear to understand practical then just read.

Dilshad
Автор

@seen8 That's a very good question. When you do integer division it does not round, it takes the floor, that is, it will simply give you the integer part of the actual answer. This is not specific to C. This is how the processor is designed. Only if you use floating point numbers (as you said if I had used 6.0, or typecast), there is a possibility of rounding up. But for that you will have to write your own function. Maybe you can do it as an exercise ;-) Check out my tutorials on Functions.

Learnorama
Автор

Make sure you initialize sum. For example if you type "int sum;" and never give it a value, then later you try to compute avg using sum, then avg will end up with a garbage value in the end. Easy fix: "int sum=0;"

ctutorial
Автор

@Cybernetic Also you can use float like he uses in the video and set precision to get just one or two decimals following.

IBanishmntI
Автор

Wow wonderful really fantastic video ...

habibmu
Автор

Just for teaching purposes. But it is better to keep the input section separate from processing section. In this example, you can combine. In general you may not be able to do so.

Learnorama
Автор

@Cybernetic As long as you initialize sum as "double sum; at 0.0". and the same with avg. just divide by the int and display double.

IBanishmntI
Автор

thnxs a lot broo this video is awesome.good work.keep it up....dude :D

ruwanbhagya
Автор

Thanks these tutorials are awesome..
But i wonder why did you made 2 loops? I thought of doing it in one loop it self

mahidoes
Автор

i just had a question when u did the integer division it rounded the value..
but if u had used 6.0 it would have been 10.7 but thats not realistic with ages.
so why didnt the value round up till 11..
thanks for all ur help...

seen
Автор

what about the 2 dimesnions array Sir ? please my you add a video about them

armirexx
Автор

My output is weird. May be it shows me the memory address. Because it does not show me the exact result. Can you Please tell me whats wrong with that?

MultiFaroque
welcome to shbcf.ru