+ 2
Coding
I have a doubt. Actually why we study programs in arrays, fibonacci etc...? What is the real reason behind this?
5 Answers
+ 4
@ramis One thing i want to know from u dat in math why we cannot study only theorm n dats all but we study the question i.e.exercise it may give u a logic as same in this only they give u logic how d program work or anything so when u make big program this small program wll help u so much....
//Hope u get it
+ 3
Arrays and functions are necessary part of coding. If you learn and understand how to make them on examples, you will manage to create your own codes and projects using these subjects.
+ 1
what is the practical application of this?
+ 1
Try building Chrome without using arrays. Spoiler alert: You can't.
+ 1
@ramis
If you have learn programming a little bit, you must know array is simply a 'collection' of elements of same data type. For example, if you need 50 integer values, instead of creating 50 explicit integer variables:
int a1;
int a2;
int a3;
.
.
.
int a50;
/*We can simple create an array of 50 integers*/
int arrayOfInt[50];
/*Just like that, we got 50 integer variables*/
Now we could write code to initialize each element of array explicitly. But if we use a for loop, it will save our time, make our code look neater and faster.
Function:
Similarly functions are used to divide our load of work. You must have heard the phrase 'divide and conquer'!
We divide our one big problem into small problems. Then we solve each problem.
For example, we have a task: Take 10 numbers as input from user. Cast those numbers into char datatype. Display each character on a newline.
Now we can break this problem into functions.
One function can simply take 10 numbers as input.
2nd function will cast and 3rd will display