I would like to know how can i implement sizeof() operator.Can anyone please give me the code and alos i would like to know how to know the size of a structure without using sizeof() operator.
First What Language and or SQL database are you using?
Can't really help without that info.
I use SizeOF commands to determine the dimentions of my variables when loading data into memory from a database. You can also, depending on the database system yu are using, get the dementions of the fields directly from the schema data. Some databases have system level tables which contain things like the triggers, procedures, and schemas where you can access that information directly.
With out more information on what you are trying to do, we can not be much help.
In C, the sizeof pseudo-function actually evaluates at compile time, not at run time. Most compilers treat it as a compile time directive (much like a #define) that resolves to a lookup into the symbol table for the referenced symbol that returns the target object's size in bytes as stored in the symbol table.
There are a number of public domain C compilers. I'd recommend checking out gcc from gnu to see a nice clean implementation.