Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to make the function return value of C language into an array?
How to make the function return value of C language into an array?
//method 1, returns a static variable.

Char * subfunction (void)

{

static char SZ text[5]= " adfa "; //Use static space

//assign a value to p.

Return to szText

}

Void Caller() // This function calls SubFunction.

{

TRACE("%s\n ",subfunction);

}

//Method 2, pass with a pointer

Void subfunction (char *pText 1, char *pText2)

{

//operate pText 1, pText2.

Strcpy(pText 1, "love");

Strcpy(pText2, "you");

Return;

}

Void Caller() // This function calls SubFunction.

{

char szText 1[5],SZ text 2[5]; //Of course, memory can also be allocated dynamically here.

Subfunctions (szText 1, sztext2); // szText 1, szText2 is the value brought back.

TRACE("%s %s\n ",szText 1,SZ text 2);

}