Home

A program to explain POINTERS to STRINGS

C Programming Language 110

Program

#include <stdio.h>

void main()
{
    char *names[3] = {"John\0", "Bob\0", "Carol\0"};
    int i;
    printf("Names are \n");
    for (i = 0; i < 3; i++)
    {
        printf("\n%s", names[i]);
    }

    printf("\n");
}

Result

Names are

John
Bob
Carol


Last Updated on

Next Post: GraphProtocol: TS2322 null assignment in Subgraph →

Comments