KidzTalk

How do you return a pointer to an array in C++?

+10 votes
71 views
asked Oct 3, 2019 in Science by gary
Im am only 7 yers old so i need abit of help witrh this. How do i return a pointer to an array from a function in c++. thanks guys


3 Answers

+1 vote
answered Oct 5, 2019 by kitten (628,490 points)

Way-1

Formal parameters as a pointer as follows −

void myFunction(int *param) {
   .
   .
   .
}

Way-2

Formal parameters as a sized array as follows −

void myFunction(int param[10]) {
   .
   .
   .
}

Way-3

Formal parameters as an unsized array as follows −

void myFunction(int param[]) {
   .
   .
   .
}
commented Dec 18, 2019 by kitten (628,490 points)
did this help?
+1 vote
answered Oct 4, 2019 by im kanye (372,780 points)
I'm in 7th grade and I have no idea what you are talking about, and I just don't know if I'm just dumb 'coz I'm doing okay at school
commented Oct 5, 2019 by kitten (628,490 points)
You are not dumb. C ++ is a computer software language that makes up the MS DOS and windows 96, XP, vista, 7, 8.1, and 10 operating systems. Most people just don't know that.
commented Oct 5, 2019 by im kanye (372,780 points)
Oh, thank goodness lol.
commented Dec 18, 2019 by kitten (628,490 points)
:D
+2 votes
answered Oct 3, 2019 by Puppy (3,760 points)
Are you makong computer software?

Related questions

+11 votes
15 answers 599 views
+1 vote
1 answer 27 views
asked Jul 31 in Other by Jane
+10 votes
1 answer 66 views
+1 vote
0 answers 15 views
asked Aug 5 in Other by Jane
+9 votes
15 answers 155 views
+7 votes
1 answer 75 views
+2 votes
1 answer 42 views
asked Aug 25 in Other by Jane
+9 votes
9 answers 457 views
asked May 17, 2016 in Other by Horselover101
+1 vote
0 answers 20 views
asked Aug 27 in Other by Jane
+4 votes
1 answer 29 views
+1 vote
1 answer 26 views
+1 vote
0 answers 12 views
0 votes
1 answer 10 views

Recent Badges

Popular Question
Asked question received 100 views
- -GEMHeart- -
Notable Question
Asked question received 50 views
- -GEMHeart- -
Popular Question
Asked question received 100 views
- Lemony The Bean -
Popular Question
Asked question received 100 views
- L -
Notable Question
Asked question received 50 views
- lunalovegoodmolly -
...