some say floats can't be stored in register.
This is immaterial to C. They certainly can be declared using the
register keyword, but whether that actually results in them being stored
in a register is something the Standard cannot possibly require.
size of int and float are same ( on some machine am i Wrong?)
On some machine, sure. On others they're not.
so if int can be delcared as register than why not float(where in and
float are of same size) ?
_If_ it were true that there is a machine on which int and float are the
same size, and _if_ it were true that on that machine ints could be
stored in registers, and floats couldn't, _then_ a reason could be that
this machine has specialised integer and floating point registers, and
the FP unit only works on doubles.
On the other hand, _if_ there were a machine on which int and float are
widely different sizes, and _if_ on that machine both floats and ints
could be stored in registers, _then_ the reason could be that this
machine, too, has specialised integer and floating point registers, but
its FPU can handle both floats and doubles.
The important thing, though, is that the C language requires neither of
these machines to exist. All it requires is that all objects can be
declared with the register storage class, and (quote from n869.txt):
# [#4] A declaration of an identifier for an object with
# storage-class specifier register suggests that access to the
# object be as fast as possible. The extent to which such
# suggestions are effective is implementation-defined.
IOW, the register keyword is _supposed_ to make the object faster, and
this is _usually_ achieved by putting it in a hardware register, but the
Standard can demand nothing in this respect. Hey, some machines might
not even _have_ registers!
Richard