Question: I have four different divs with slideToggle function. I set them to slidetoggle on click, and they work fine. However, I want the rest of the divs to close when one div is clicked. can anyone help?
below is the code I have so far. 

```
<div id="01"><p>title</p></div>
    <div id="01_sub"><p>content</p></div>
<div id="02"><p>title</p></div>
    <div id="02_sub"><p>content</p></div>
<div id="03"><p>title</p></div>
    <div id="03_sub"><p>content</p></div>
<div id="04"><p>title</p></div>
    <div id="04_sub"><p>content</p></div>

$('#01_sub').hide();
      $('#01').click(function() {
       $('#01_sub').slideToggle('medium');
     });
     $('#02_sub').hide();
      $('#02').click(function() {
       $('#02_sub').slideToggle('medium');
     });
     $('#03_sub').hide();
      $('#03').click(function() {
       $('#03_sub').slideToggle('medium');
     });
     $('#04_sub').hide();
      $('#04').click(function() {
       $('#04_sub').slideToggle('medium');
     });

```

so basically, if I click #01, I want #02,#03,#04 to stay closed or to be closed. and if I click #02, I want the rest to close.

Answer: 
There are *many* possibilities here. Here's a few.

In the function version, the argument is explicitly typed as a `float`. This means that if you call

```
f(1);

```

then `1` is converted to the float `1.0f` as the argument. Then, when `1 / (1 + x * x)` is computed, it evaluates to `1 / 2.0f`, which comes out to `0.5f`. However, in the macro version, `f(1)` would be evaluated as `1 / 2` using integer division, yielding the value 0.

Second, in the function version, the argument is evaluated only once. This means that

```
int x = 0;
f(x++);

```

will increment `x` to `1`, then pass in the value `0`. The result will then be `1.0f`. In the macro version, however, the code expands to

```
1 / (1 + x++ * x++)

```

This causes has *undefined behavior* because there is no sequence point between the evaluations of `x++`. This expression could evaluate to *anything*, or it could crash the program outright.

Finally, the function version respects operator precedence while the macro does not. For example, in the function version, calling

```
f(1 - 1)

```

will call `f(0)`, evaluating to `1.0f`. In the macro version, this expands to

```
  1 / (1 + 1 - 1 * 1 - 1)
= 1 / (1 + 1 - 1 - 1)
= 1 / 0

```

This causes undefined behavior because of a divide-by-zero error.

The simple way to avoid this is to *not use macros to define functions*. Way back in the Bad Old Days this was a standard practice, but now that C has `inline` functions and compilers are way smarter, you should prefer functions to macros. They're safer, easier to use, and harder to mess up. They're also type aware and don't evaluate arguments multiple times.

Hope this helps!
```
#define f(x) 1/(1+x*x)

```

should be defined as

```
#define f(x) 1/(1+(x)*(x))

```