Skip to content

Commit

Permalink
Create dinamik-char-dizisi.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Ufuk Can Erdoğan authored Jan 21, 2017
1 parent 7ac6fe4 commit b3cace5
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions dinamik-char-dizisi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* dinamik-char-dizisi.c
*
* 2017 Ozmo <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/

#include <stdio.h>
#include <stdlib.h>
char *yaziGirisi(int);
int main()
{
int yaziUzunlugu;
printf("Yazının uzunluğunu giriniz: ");
fscanf(stdin,"%u",&yaziUzunlugu);
getc(stdin);
char *tut = yaziGirisi(yaziUzunlugu);
for(int i = 0; i < yaziUzunlugu; i++)
{
fprintf(stdout,"%c\n",tut[i]);
}
free(tut);
return 0;
}

char *yaziGirisi(int uzunluk)
{
char *string = (char *)malloc(sizeof(char)*uzunluk);
fprintf(stdout,"Yazı giriniz: ");
fgets(string,uzunluk+1,stdin);
return string;
}

0 comments on commit b3cace5

Please sign in to comment.