S
srinivas.satish
Hi,
i checked this piece of code with both gcc as well as vc++
compilers. Behaviour is same. I don't understand the behaviour. Can
some1 please explain the reason of the result.
#include<stdio.h>
#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};
int main()
{
int d = -1;
for(d=-1;d <= ((TOTAL_ELEMENTS-2));d++)
printf("%d\n",array[d+1]);
return 0;
}
It never enters into the loop.
or even if it is simply like this
int main()
{
int d = -1;
if ( d < sizeof(int) )
printf (" Success ");
}
it never prints, any explanation.
i checked this piece of code with both gcc as well as vc++
compilers. Behaviour is same. I don't understand the behaviour. Can
some1 please explain the reason of the result.
#include<stdio.h>
#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};
int main()
{
int d = -1;
for(d=-1;d <= ((TOTAL_ELEMENTS-2));d++)
printf("%d\n",array[d+1]);
return 0;
}
It never enters into the loop.
or even if it is simply like this
int main()
{
int d = -1;
if ( d < sizeof(int) )
printf (" Success ");
}
it never prints, any explanation.