Created
November 21, 2010 21:00
-
-
Save sayz/709151 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 <string.h> | |
#include <ctype.h> | |
#define N 15 | |
void buyut(char dizge[]) { | |
int i,j; | |
char depo[N]; | |
j = strlen(dizge)-1; | |
for (i = 0; i < strlen(dizge); i++) { | |
if (i == 0 || i == j) { | |
depo[i] = toupper(dizge[i]); | |
} | |
else { | |
depo[i] = dizge[i]; | |
} | |
} | |
printf("%s ",depo); | |
} | |
int main() | |
{ | |
char str[N] = "merhaba dunya"; | |
char delims[] = " "; | |
char *result = NULL; | |
result = strtok( str, delims ); | |
while ( result != NULL ) { | |
buyut(result); | |
result = strtok( NULL, delims ); | |
} | |
return 0; | |
} |
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 <string.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
#define N 15 | |
char buyut(char *dizge) { | |
int i,j; | |
char depo[N] = ""; | |
j = strlen(dizge)-1; | |
for (i = 0; i < strlen(dizge); i++) { | |
if (i == 0 || i == j) { | |
depo[i] = toupper(dizge[i]); | |
} | |
else { | |
depo[i] = dizge[i]; | |
} | |
} | |
return depo; //sorunlu yer | |
} |
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 <string.h> | |
#include <ctype.h> | |
#define N 100 | |
char *buyut(char*, char*); | |
int main() | |
{ | |
char str[N] = "merhaba dunya istersen daha fazla kelime olsun"; | |
char tp[N] = ""; | |
char delims[] = " "; | |
char *a, *result = NULL; | |
result = strtok(str, delims); //bu fonksiyon split islemi icin... | |
while ( result != NULL ) { | |
a = buyut(result, tp); | |
result = strtok( NULL, delims ); | |
a = strcat(a, " "); | |
} | |
puts(a); | |
return 0; | |
} | |
char *buyut(char *dizge, char *tp) { | |
int i,j; | |
char depo[N]; | |
j = strlen(dizge)-1; | |
for (i = 0; i < strlen(dizge); i++) { | |
if (i == 0 || i == j) { | |
depo[i] = toupper(dizge[i]); //kelimenin ilk-son harflerini buyutme islemi... | |
} | |
else { | |
depo[i] = dizge[i]; | |
} | |
} | |
strcat(tp,depo); //pointer donus degeri icin birlestirme islemi... | |
return tp; | |
} |
sonunda öğrendim ki: bir fonksiyon string değil ama onun yerine pointer dönebilirmiş. güç oldu ama güzel oldu sanırım. gecenin 4'ünde ancak bu kadar oluyor :-).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
buyut.c
'de buyut fonksiyonunadepo
'yu döndürtemedim. o yüzden,buyut-full.c
'de buyut fonksiyonu issue2'de istenilen şeyi yapıyor ama tam olarak istediğim şekilde değil. c dlinde bir fonksiyona string bir ifadeyi nasıl döndüreceğiz bunu öğrenmem lazım.