[Courses] [C] Lesson Three: Basic Declarations & Expressions
KWMelvin
kwmelvin at intrex.net
Thu Oct 10 10:57:28 EST 2002
On Thu, Oct 10, 2002 at 06:14:26PM +0300, Anca M. Holban wrote:
>
> I'd do smth like this:
>
> #include "stdio.h"
> int main(void)
> {
> printf("%d\n",sizeof(int));
> printf("%d\n",sizeof(float));
> printf("%d\n",sizeof(double));
> return 0;
> }
Yes! That is *very* elegant, indeed!
Detail:
We srround a header file by quotation marks instead
of angle brackets to indicate that it is our own
include file, and not one that is system supplied.
That way the preprocessor will search our files first,
before searching the standard system locations for it.
#include "myheader.h" /* contains my declarations, etc. */
#include <stdio.h> /* Standard C Library header file */
When I compile the above code, the compiler gives this error:
$ gcc -o size size.c
gcc: size.c: No such file or directory
gcc: No input files
$
I would like to encourage everyone who is following these
`beginner' lessons to contribute feedback, solutions, and
so forth. These are labeled `beginner' lessons because
I don't think there will be anything of interest to more
experienced C programmers for awhile. However, we beginners
will certainly benefit from hearing from the voices of
experience. I'm sure that veteran programmers can help
us without going over our heads too much? Just try and
gear it to our level. 8^D
In other words, please help us! We need all the help we
can get. All of the beginners who are following these
lessons: please contribute and share your solutions with
the rest of us. We will all benefit. The more the merrier!
Happy Programming!
--
K
More information about the Courses
mailing list