What is the difference between structure and function and arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between structure and function and arrays

Getting a bit confused so

13th Sep 2019, 5:03 PM
Udith S M
Udith S M - avatar
7 Answers
+ 3
Alright what confused you? I'm not here to re explain what is in the course.
13th Sep 2019, 5:05 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
No. Functions are loops of code that execute some statements. Structures are datatypes that hold data.
13th Sep 2019, 5:09 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Function - Subprograms that can be called by the main function repeatedly (like add(int a,int b),you can call it to do addition) Array - A sequence of values in a fixed size ( You can imagine this as a box) Struct - A group of elements under one name . For example : struct gender{ string male; string female; }
15th Sep 2019, 3:03 AM
Joey Lim
Joey Lim - avatar
+ 1
No what is better
13th Sep 2019, 5:06 PM
Udith S M
Udith S M - avatar
+ 1
Function and structure are same right
13th Sep 2019, 5:06 PM
Udith S M
Udith S M - avatar
+ 1
So we can't write statement in structure and function we can right
13th Sep 2019, 5:10 PM
Udith S M
Udith S M - avatar
+ 1
Shortly: -Array is a sequence of values. -Function is a piece of normal code with a name. When functions are called, they take in arguments, run their code and return a value.
13th Sep 2019, 5:26 PM
Seb TheS
Seb TheS - avatar