[ create a new paste ] login | about

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

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


void deneme();

int main() {
    #define OZELSABIT1  1
    const int OZELSABIT2 = 2;
    printf("Main Fonksiyonu:");
    printf("OZELSABIT1");
    printf("%i",OZELSABIT2);

    deneme();

}


void deneme () {
     printf("Main Fonksiyonu:");
     printf("OZELSABIT1");
     printf("%i",OZELSABIT2); // Derleyici burada hata verecektir.
    /* Çünkü const özel olarak tanımlanmıştır. 
     Fakat define ise global olarak tanımlandığı için üstte hata vermez. 
     Eğer sabitlerinizi özel olarak tanımlamak istiyorsanız const kullanmak daha mantıklı.*/
}


Output:
1
2
3
4
In function 'deneme':
Line 21: error: 'OZELSABIT2' undeclared (first use in this function)
Line 21: error: (Each undeclared identifier is reported only once
Line 21: error: for each function it appears in.)


Create a new paste based on this one


Comments: