C program for Reading & Writing String (Manual)(character by character)

#include <stdio.h>
int main()

 {
    char str[50];
    int i;

    printf("Enter string: ");

    for(i = 0; (str[i] = getchar()) != '\n'; i++);
    str[i] = '\0';

    printf("String is: ");

    for(i = 0; str[i] != '\0'; i++) {
        putchar(str[i]);
    }

}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices