hi namita ,
thanks for the reply , but my actual doubt was how could we create
basic data types like int , and incorporate  them into the library and
use them again and again ,.....this was all started when i was
thinking about a 'smart int' (which is not a genuine idea, picked up
from the GSoc ideas for BoostC++), this type of variable can have
limits in which the value must lie !!

On 4/21/08, Namita Iyer <[EMAIL PROTECTED]> wrote:
> eerpinisatish wrote:
> > hi all,
> > i have a small doubt, how are variable type like int , or float
> > actually defined in C, like if i want to define a new variable type ,
> > which is say completely new, then how do i do it and then use it again
> > and again in my programs ??, is it something like the library
> > functions , or is there a different method ??
> >
>
> Types in C are defined in the compiler's source code logic.
> To define a new type of your own, you can use 'typedef'.
>
> eg. define your new type as follows;
>     typedef int Age;
>
> and use your new type, as often as you like, as follows:
>     Age ageOfA = 10;
>     Age ageOfB = 20;
>
> Since the basic types like int, float etc are defined statically in the
> source code,
> you will have to create your types based on them.
>
> A better example is:
>
> typedef struct _studentRecord {
>     char name[20];
>     int  age;
> } studentRecord;
>
>
> studentRecord recordForStudentA = {"satish", 10};
>
>
> - Namita
>

Reply via email to