Are these two codes different?
if yes, then how?
if not, then why is same code giving different answers?

//[code 1](http://ideone.com/pgmqo7)

```
#include<iostream>
#include<cstdio>

using namespace std;

#define PI 3.14

void fun() {
    printf("%f\n",PI);
}

int main() {
    printf("%f\n",PI);
    #define PI 3.141528
    fun();
}

```

**3.140000**

**3.140000**

//[code 2](http://ideone.com/I9B11X)

```
#include<iostream>
#include<cstdio>

using namespace std;

#define PI 3.14

void fun();

int main() {
    printf("%f\n",PI);
    #define PI 3.141528
    fun();
}

void fun() {
    printf("%f\n",PI);
}

```

**3.140000**

**3.141528**

Or is it the issue with preprocessor directives?