Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    C Strings

    In C programming, one-dimensional arrays of characters are called strings, terminated by a null character '\0'. In this tutorial, you will learn about C Strings, how it works in the C language and how you can use them in your C program.

    Strings Declaration in C

    There are two ways to declare a string in C programming:

    Example:

    Through an array of characters.

    char name[6];

    Through pointers.

    char *name;

    Strings Initialization in C

    Example:

    char name[6] = {'C', 'l', 'o', 'u', 'd', '\0'};

    or

    char name[] = "Cloud";

    Memory Representation of Above Defined String in C

    c-strings

    Example:

    #include<stdio.h>
    
    int main ()
    {
        char name[6] = {'C', 'l', 'o', 'u', 'd', '\0'};
    
        printf("Tutorials%s\n", name );
    
        return 0;
    }

    Program Output:

    TutorialsCloud


    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.