char (*subcut)(char *,int,int); Define a function whose return value is a pointer
查看答案
A function can return an integer value, a character value, a real value, etc., or data of pointer type.
The function scmp in the following program returns the first address of the smaller string in the strings pointed by formal parameter pointers s1 and s2. #includechar *scmp (char *s1,char *s2) { if (strcmp(s1,s2)< 0) return(s1); else return (s2); } main() { int i;char string[20],str[3][20]; for (i=0;i <3;i++) gets (str[i]); strcpy(string,scmp(str[0],str[1])); /* strcpy library function copies strings */ strcpy(string,scmp (string,str[2])); printf("%s\n",string); } If inputs three strings in turn: abcd, abba, and abc, the output is ( )
A. abcd
B. abba
C. abc
D. abca
When a global variable is declared as static, the scope of the variable is limited to the module in this file.
Global variables are stored in dynamic storage.