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
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