I ran same code linux and HP platform And the result stored was different.
I found that the boundar for comparison is 255.
It can be more undersstood from the below code.
int a = 100;
for (i=0; i <= 32767; i++)
c = memcmp(&a,&i,sizeof(int));
if ( c >0 )
fprintf (fp,"Value is -1 when i = %d\n",i);
The answer stored in Linux and HP was different.
In HP the text file created had only first 99 numbers but on linux it was 0-99 then 256-355 and so on.
Anyone have any idea about limitation of memcmp function.