Can I turn the array over with a function factor without a pointer?

Asked 1 years ago, Updated 1 years ago, 140 views

int a[5][5];
int* a[5];
int** a;

When you get an array as a factor, you have to choose one of those three and unify it Is there any way I can turn it over without using a pointer?

c array coding-style struct

2022-09-22 22:18

1 Answers

I can't just move on to the arrangement itself You can do it if you use a structure with only an array of members.


typedef struct {
    unsigned long array[MAX];
}ABC;

ABC foo(ABC myinput){
    myinput.array[0] = 1;

    //...
    return myinput;
}

This allows the structure to be returned to value rather than address, and the function returns to value


2022-09-22 22:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.