[Courses] [C] Beginner's Lesson 4A: Arrays, Qualifiers, and
Reading Numbers
Anca M. Holban
anca at lsv.cl.edu.ro
Fri Oct 11 17:39:39 EST 2002
I know i should use #include <stdio.h> instead of #include "stdio.h", and
I'm trying to get rid off this *habbit*. Thanks Eugene :)
On Fri, 11 Oct 2002, Eugene Teo wrote:
> u> #include "stdio.h"
>
> Always do #include <stdio.h>. stdio.h is a header file not written by
> you :-)
>
> u> int main(void)
> u> {
> u> fload data[5]={34.0,27.0,45.0,82.0,22.0};
> u> double total;
> int a;
> for(a=0; a<sizeof(data)/sizeof(int); ++a)
> total+=data[a];
> u> printf("total: %.2f, average: %.2f.\n",total,total/5.0);
> since total is a double, do %.2lf instead of %.2f.
>
> ps: hehe, i am finishing a module on unix programming... did too
> much C, AWK, SED :P
>
> Eugene
>
--
o
More information about the Courses
mailing list