N
Nishu
Hi all,
I was under the impression that below code should give errors while
compiling, since i'm using same name for macro as well as function. but
it didnt give any errors!!
Isnt this is correct that pre-processors are processed before compiling
and wherever the "matched" label is found, pre-processor replaces it
with corresponding code snippet.
Is it defined in standard that scope of pre-processor starts only for
the code which occurs after its definition? (Now, In practice, I AVOID
using macros in small letters. Its just an example to clarify my
doubt.)
#include<stdio.h>
int min(int x, int y)
{
return (((x) < (y))? (x) : (y));
}
int main(void)
{
int i, j, k, l;
i = 1;
j =2;
k = min(i,j);
#define min(x,y) (((x) < (y))? (x) : (y))
l = min(i,j);
printf("k = %d l = %d", k, l);
return 0;
}
Thanks.
-Nishu
I was under the impression that below code should give errors while
compiling, since i'm using same name for macro as well as function. but
it didnt give any errors!!
Isnt this is correct that pre-processors are processed before compiling
and wherever the "matched" label is found, pre-processor replaces it
with corresponding code snippet.
Is it defined in standard that scope of pre-processor starts only for
the code which occurs after its definition? (Now, In practice, I AVOID
using macros in small letters. Its just an example to clarify my
doubt.)
#include<stdio.h>
int min(int x, int y)
{
return (((x) < (y))? (x) : (y));
}
int main(void)
{
int i, j, k, l;
i = 1;
j =2;
k = min(i,j);
#define min(x,y) (((x) < (y))? (x) : (y))
l = min(i,j);
printf("k = %d l = %d", k, l);
return 0;
}
Thanks.
-Nishu