Question: This question was at the interview:
*Does this code causes any compile/linking errors and why so?*

```
template <int T> void f();
template <> void f<0>() {}

void test() 
{
    f<1>();
}

```

Please explain the behaviour. Thanks a lot.

Answer: 
```
template<> void f<0>() {}

```

is specialization of function template for argument `0`, if you call `f<0>()` this version of function will be called.

This code is incorrect, it cause linking errors, since there is no specialization for `f<1>` and template version of function is not `defined`.
It will compile because compiler can see a declaration for a generic template. There is a fully specialized template for 0 also. But we are calling it for 1, which will try to invoke the generic template, but since linker cannot find any definition for the general template, the program will show linker error.

Soloution

```
template <int T> void f();
template <> void f<0>() {}
template <int T> void f() { }

void test() 
{
  f<1>();
}

```