What will the following program print? string copy - C String

C examples for String:char array

Description

What will the following program print? string copy

Demo Code

#include <stdio.h> 
#include <string.h> 
int main(void) 
{ 
    char s1[40] = "this is a test"; 
    char s2[40] = " from book 2s.com "; 
    const char * quote = "the way through."; 
 
    strcat(s1, quote); /*  ww w .  ja v a2 s  .  c o  m*/
    strcat( s2, s1); 
    puts(s2); 
    return 0; 
}

Result


Related Tutorials