trying to simplify an algorithm

Andrew Calkin calkin at ieee.org
Tue Mar 1 07:44:22 PST 2005


On Tue, Mar 01, 2005 at 10:33:10AM -0500, Hui Zhou wrote:
> On Tue, Mar 01, 2005 at 08:25:26AM -0700, Kevin P. Fleming wrote:
> >Hui Zhou wrote:
> >
> ;-) Actually fopen returns a pointer! I guess I meant to say the 
> statement made it clear that fopen returns a pointer and we are 
> testing whether it is NULL. 
That's what I thought too...
> 
> However, in C, pointer is integer, another feature sometime frowned 
> upon.
I thought a pointer was a pointer, but C allowed pointer arithmetic.
That was why when you declare a pointer variable, you need the type
defined for which the pointer will be used, right? So then the
pointer arithmetic knows how many bytes are used in e.g. an element
of an array of characters as opposed to an array of integers or an
array of floating-point numbers, for example.

Or am I wrong here?

//Andrew



More information about the lfs-chat mailing list