[ create a new paste ] login | about

Link: http://codepad.org/DXaAx3rq    [ raw code | output | fork ]

C, pasted on Jun 1:
#include <stdio.h>



//Hatalı Kullanım:

const char *SABIT_ADI="SABIT1";
const int SABIT_ADI=1;

SABIT_ADI="SABIT2";
SABIT_ADI=2;


/*
#define SABIT_ADI SABIT1
const int SABIT_ADI =1;

#define SABIT_ADI SABIT2
const int SABIT_ADI =2;

*/

int main() {
    printf("SABIT1:%i\n  SABIT2:%i\n",SABIT1,SABIT_ADI); // SABIT_ADI yerine SABIT2 de yazabilirdik. 
   //Fakat son tanımlanan SABIT_ADI degeri SABIT2 olduğu için buda aynı kapıya çıkacaktır.
   return 0;

}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
Line 8: error: conflicting type qualifiers for 'SABIT_ADI'
Line 7: error: previous definition of 'SABIT_ADI' was here
Line 10: warning: data definition has no type or storage class
Line 10: error: conflicting types for 'SABIT_ADI'
Line 7: error: previous definition of 'SABIT_ADI' was here
Line 10: warning: initialization makes integer from pointer without a cast
Line 11: warning: data definition has no type or storage class
Line 11: error: conflicting types for 'SABIT_ADI'
Line 7: error: previous definition of 'SABIT_ADI' was here
In function 'main':
Line 24: error: 'SABIT1' undeclared (first use in this function)
Line 24: error: (Each undeclared identifier is reported only once
Line 24: error: for each function it appears in.)


Create a new paste based on this one


Comments: