Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 521 Bytes

6.2.md

File metadata and controls

25 lines (16 loc) · 521 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 `{`, and no two paramaters can have the same name.
int calc(int v1, int v2) { /* ... */ }

(d)

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