Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > C program not executing more than once

Reply
Thread Tools

C program not executing more than once

 
 
satya123 satya123 is offline
Junior Member
Join Date: Jul 2010
Posts: 6
 
      03-24-2011
Hi all,

I have written the following code for displaying the characters which are more than 20 characters

/* Write a program to print all input lines that
are longer than 20 characters */

#include <stdio.h>
int main()
{
int c;
unsigned int nw=0;
char array[100];

while((c = getchar()) != EOF)
{
array[nw] = c;
nw++;

if(c == '\n')
{
if(nw >= 20)
{
array[nw] = '\0';
printf("%s",array);
nw=0;
}
else
{
printf("Sorry less than 20 Char\n");
nw=0;
}
}
}
return 0;
}

i have compiled the above program in command prompt using the command tcc test.c the compiler then generates test.exe file. For the first time if i type test it gives me the expected output, but if i run the program again by typing test, the program does not run. i need to recompile the program again to execute the program. could somebody help me on this?

Thanks
satya
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not `setlocale(3)' more than once in Linux Steven Woody C Programming 7 04-28-2008 09:46 AM
User Control with popup used more than once per page does not work lds ASP .Net 0 10-23-2007 02:27 PM
TKinter -- '<Destroy>' event executing more than once? Christopher Subich Python 4 06-12-2005 04:29 PM
Can't run BLT program more than once? Todd Krein Python 0 04-28-2005 07:46 PM
Regex to match say char 't' exactly once in a string and no more than once Gancy Perl Misc 4 02-03-2005 02:19 PM



Advertisments