fgets kullanim

kullanicidan isim alan fonksiyon
mail@pastecode.io avatar
unknown
c_cpp
2 years ago
406 B
4
Indexable
Never
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

#define SIZE 32

int main()
{
    char isim[SIZE];

    fprintf(stdout, "Isminizi giriniz = ");
    if (!fgets(isim, SIZE, stdin))
        fprintf(stderr, "Islem basarisiz oldu\n");

    int i = 0;
    while (isim[i++] != '\n')
        ;
    isim[i - 1] = '\0';

    fprintf(stdout, "Girilen isim = [%s]\n", isim);

    return 0;
}