Reading Strings with scanf() - C String

C examples for String:String Console Input

Description

Reading Strings with scanf()

Demo Code

#include <stdio.h>

int main (void)
{
    char s1[81], s2[81], s3[81];

    printf ("Enter text:\n");

    scanf ("%s%s%s", s1, s2, s3);

    printf("\ns1 = %s\ns2 = %s\ns3 = %s", s1, s2, s3);

    return 0;/*ww  w. ja  v a 2s.c o  m*/
}

Result


Related Tutorials