X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: lando User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: gcc Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 80 Message-ID: Date: Tue, 13 Jan 2004 17:06:19 GMT NNTP-Posting-Host: 80.180.169.215 X-Complaints-To: newsmaster AT tin DOT it X-Trace: news4.tin.it 1074013579 80.180.169.215 (Tue, 13 Jan 2004 18:06:19 MET) NNTP-Posting-Date: Tue, 13 Jan 2004 18:06:19 MET Organization: TIN To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com This program (copied from "The C programming language" by Kernigham/ Ritchie) doesn't work fine. The operator enters some strings of characters and at EOF the program has to display the longest string typed.........and this doesn't happen. Where is the problem ?Thanks a lot. #include #define MAXLINE 100 int max; char line[MAXLINE]; char longest[MAXLINE]; int getline(void); void copy(void); main() { int len; extern int max; extern char longest[MAXLINE]; max=0; while ((len=getline()) > 0) if (len > max) { max = len; copy(); } if (max > 0) printf("%s",longest,'\n'); return 0; } int getline(void) { int c,i; extern char line[]; for (i=0;i