Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 474 Bytes

6.2.md

File metadata and controls

25 lines (16 loc) · 474 Bytes

(a)

//int f() {  // Return type doesn't match
string f() {
  string s;
  // ...
  return s;
}

(b)

//f2(int i) { /* ... */ }  // Must have a return type
void f2(int i) { /* ... */ }

(c)

//int calc(int v1, int v1) /* ... */ }  // Forget begin brace `{`
int calc(int v1, int v1) { /* ... */ }

(d)

//double square(double x) return x * x;  // The function body should be a block.
double square(double x) { return x * x; }