is it possible to create an array then you pass it to a function? That function will change the values in the array then return it back as an array.
odee
0
Light Poster
Recommended Answers
Jump to PostYes, ever use strcpy?
Jump to Post#include <iostream> using namespace std; int *changeArray(int array[], int size) { // this is where you change the values inside the array. return array; // return a pointer to the start of the array } int main(void) { int x[5]; for ( int y=0;y<5;y++ ) // Input …
Jump to Postwhich one is better the previous one with the * in the changeArray() and with the return statement or my revision? they have the same output i just want to know which one is better to use...
If you're not going to use a return value, then you don't need …
Jump to PostchangeArray(x, 5); // pass the array to the changeArray() function
Whether or not the function returns a value, you do not use it -- so there will be nothing to notice. One returns a value that you ignore, the other doesn't return a value that you could …
All 13 Replies
Dave Sinkula
2,398
long time no c
Team Colleague
odee
0
Light Poster
Dave Sinkula
2,398
long time no c
Team Colleague
odee
0
Light Poster
odee
0
Light Poster
Dave Sinkula
2,398
long time no c
Team Colleague
odee
0
Light Poster
Dave Sinkula
2,398
long time no c
Team Colleague
odee
0
Light Poster
Dave Sinkula
2,398
long time no c
Team Colleague
Dave Sinkula
2,398
long time no c
Team Colleague
odee
0
Light Poster
Dave Sinkula
2,398
long time no c
Team Colleague
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.