#include<iostream>
using namespace std;
void getdata (int a[], int size);
int main ()
{
int size=10;
int a[size];
getdata (a[], size);
return 0;
}
void getdata (int a[], int size)
{
for (int i=0; i<size; i++)
cin>>a[i];
}
kamalashraf
0
Newbie Poster
Recommended Answers
Jump to PostAlso, please provide the purpose of this program.
It's pretty obvious that the purpose is to populate an array from a function.
but you aren't returning the edited variable nor are you passing it by reference.
Arrays are passed by simulated reference (ie. by pointer), so …
All 4 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
PrimePackster
10
Runaway Poster
tensity
0
Light Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.