Integers are easy!
The first thing you have to do is define an integer type.  This will make
your code PORTABLE!
    typedef int my_integer_type;
Then you can define a new type that is a pointer to an integer.  This is a
shortcut that will save you a lot of work!
    typedef *my_integer_type my_integer_pointer_type;
Then you can create an actual pointer to an integer like this:
    my_integer_pointer_type my_integer;
Then you must allocate memory for the integer.  This is where the actual
number will be held!
    my_integer = malloc(sizeof(my_integer_type));
Then you can assign a value to your integer.
    *my_integer = 8;
Or print it out to the screen!
    printf("My integer is %d\n", *my_integer);

That's all there is to it!
Hope this helps.

--Palrich.



Reply via email to