-
-
Save roktas/1379491 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define BUFLEN 512 | |
char * | |
tersle(const char *dizgi) | |
{ | |
int i, uzunluk; | |
char *ters_dizgi; | |
uzunluk = strlen(dizgi); | |
ters_dizgi = (char *) malloc(uzunluk + 1); /* +1 nul için */ | |
for (i = uzunluk; i >= 0; i--) | |
ters_dizgi[uzunluk - i - 1] = dizgi[i]; | |
return ters_dizgi; | |
} | |
int | |
main(void) | |
{ | |
char *dizgi, *ters; | |
dizgi = (char *) malloc(BUFLEN); | |
printf("Dizgiyi Girin: "); | |
scanf("%s", dizgi); | |
tersi = tersle(dizgi); | |
printf("%s\n", tersi); | |
free(tersi); | |
free(dizgi); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment