Home

A program to print table of strings

C Programming Language 073

Program

#include <stdio.h>

void main()
{
    char names[5][5];
    int i;

    for (i = 0; i < 5; i++)
    {
        scanf("%s", names[i]);
    }
    printf("\nNames are:\n");

    for (i = 0; i < 5; i++)
    {
        printf("%s\n", names[i]);
    }

    printf("\n");
}

Result

Alice
Bob
Carol
Daniel
Esther

Names are:
AliceBob
Bob
CarolDanieEsther
DanieEsther
Esther


Last Updated on

Next Post: Rules vs Guidelines →

Comments