我曾尝试调试,但没有运气我不明白为什么第二个printf()调用increment()三次,但第一个调用两次按预期.
#include <stdio.h>
#define MAX(a, b) ( (a) > (b) ? (a) : (b) )
int increment(){
static int i = 42;
i += 5;
printf("increment returns %d\n", i); // 47, 52, 57
return i;
}
int main( int argc, char ** argv ) {
int x = 50;
// parameters compute from right to left side
printf("max of %d and %d is %d\n",
x, //3rd: 50
increment(), //2nd: 52
MAX(x, increment()) //1st: 50,47 -> 50
);
printf("max of %d …Run Code Online (Sandbox Code Playgroud) 表:电影
mID title year director
101 Gone with the Wind 1939 Victor Fleming
102 Star Wars 1977 George Lucas
103 The Sound of Music 1965 Robert Wise
104 E.T. 1982 Steven Spielberg
105 Titanic 1997 James Cameron
106 Snow White 1937 <null>
107 Avatar 2009 James Cameron
108 Raiders of the Lost Ark 1981 Steven Spielberg
Run Code Online (Sandbox Code Playgroud)
表:评级
rID mID stars ratingDate
201 101 2 2011-01-22
201 101 4 2011-01-27
202 106 4 <null>
203 103 2 2011-01-20
203 108 4 …Run Code Online (Sandbox Code Playgroud)