Here is a C function that returns an array with a type defined in a struct. It successfully returns the array p. My question: can I eliminate p and do a return as shown in the commented-out statement?
#include<stdio.h>
typedef struct {
    int dy, dx, iter;
} M;
  
M *boom (int x) {
    // I'm happy with this approach
    static M p[] = { {+5, +6, +7}, {+1, +1, +0}, {+3, +3, +3} };
    return p;
    // but I'm keen to know how this can be done.
//    return { {+5, +6, +7}, {+1, +1, +0}, {+3, +3, +3} };  // causes error
}
int main() {
    M *result = boom(1);
    printf("First element %d\n", result[2].dy);
}
I get "error: expected expression before '{' token" for the line I've commented out.
 
     
     
    