Coding | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Coding

I have a doubt. Actually why we study programs in arrays, fibonacci etc...? What is the real reason behind this?

30th Oct 2018, 4:13 PM
@ramis
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
30th Oct 2018, 4:30 PM
Harsh Agrawal
Harsh Agrawal - avatar
+ 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.
31st Oct 2018, 7:23 AM
Ivan
Ivan - avatar
+ 1
what is the practical application of this?
30th Oct 2018, 4:13 PM
@ramis
+ 1
Try building Chrome without using arrays. Spoiler alert: You can't.
30th Oct 2018, 5:09 PM
Vlad Serbu
Vlad Serbu - avatar
+ 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
31st Oct 2018, 8:24 AM
Sarmad Baloch
Sarmad Baloch - avatar