Skip to content

Instantly share code, notes, and snippets.

@huseyin
Created October 5, 2015 23:44
Show Gist options
  • Save huseyin/e8f7089d72aac51755e8 to your computer and use it in GitHub Desktop.
Save huseyin/e8f7089d72aac51755e8 to your computer and use it in GitHub Desktop.
gece esintisi bir kod
#include <stdio.h>
#include <stdlib.h>
#define MAX_LINE_LENGTH 81
#define MAX_BYTE_LENGTH 512
int main(void)
{
char kr;
char buffer[MAX_BYTE_LENGTH];
int i, counter = 0;
while ((kr = getchar()) != EOF)
{
buffer[counter] = kr;
counter++;
}
buffer[counter] = '\0';
for (i=0; i <= counter; i++)
{
if (i != 0 && (i % MAX_LINE_LENGTH) == 0)
printf("\n%c", buffer[i]);
else
printf("%c", buffer[i]);
}
return EXIT_SUCCESS;
}
@huseyin
Copy link
Author

huseyin commented Oct 6, 2015

Ne işe yarar ?

Aklımda iken test çıktısını da vereyim. Kernighan kitabını kurcalar iken gördüğüm bir problem idi. Ayrıntılı ele alınabilirdi ama:

- Efendim ahval -i vakt "2015-10-06 02:52:46 +0300" olunca bu kadar oluyor herhalde :)

Girdi:

The "hello, world" example, which appeared in the first edition of K&R, has become the model for an introductory program in most programming textbooks, regardless of programming language. The program prints "hello, world" to the standard output, which is usually a terminal or screen display.

Beklenen Çıktı:

The "hello, world" example, which appeared in the first edition of K&R, has becom
e the model for an introductory program in most programming textbooks, regardless
 of programming language. The program prints "hello, world" to the standard outpu
t, which is usually a terminal or screen display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment