RE: A quick c question

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 12 Mar 2008 17:50:42 -0400

This should be useful. Please look at the heading entitled, The EOF pitfall.

http://en.wikipedia.org/wiki/Fopen

Take care,
Sina

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Daniel Dalton
Sent: Wednesday, March 12, 2008 5:28 PM
To: blind programming
Subject: RE: A quick c question

Hi,

One more question:
What is a bit patton in C exactly?
And in the following program why can't we use a char instead of an int?
Wouldn't a char be better suited?
My book says its not big enough for this though.
Aren't chars meant to hold characters?
Like if the user entered 20 characters would this work?
char [20];

Thanks for any help, And my program with the int is below...


Start code:

#include <stdio.h>

int main (void)
{
      int c;

      while ((c =getchar()) !=EOF)
                          putchar (c);

      printf("%d\n", c);
      return 0;
}


Thanks,

--
Daniel Dalton

http://members.iinet.net.au/~ddalton/
d.dalton@xxxxxxxxxxxx
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: