the mystery of <ctrl-d>
- From: chandanlinster <chandanlinster@xxxxxxxxx>
- Date: 29 Apr 2007 03:31:32 -0700
/* if the program is executed as shown below:
* $./a.out
* ges<ctrl-d><ctrl-d>
*
* OUTPUT:
* Number of characters = 3
*
* Question: What happens to the first and second <ctrl-d>?
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int j;
for (j = 0; getchar() != EOF;j++)
;
fprintf(stdout, "Number of characters = %d\n", j);
exit(EXIT_SUCCESS);
}
.
- Follow-Ups:
- Re: the mystery of <ctrl-d>
- From: Kevin Handy
- Re: the mystery of <ctrl-d>
- From: Joe Wright
- Re: the mystery of <ctrl-d>
- From: Bill Pursell
- Re: the mystery of <ctrl-d>
- From: Flash Gordon
- Re: the mystery of <ctrl-d>
- Prev by Date: programming-challenges
- Next by Date: Re: typecasting
- Previous by thread: programming-challenges
- Next by thread: Re: the mystery of <ctrl-d>
- Index(es):