Use gets_s() and puts() functions to read and output string - C String

C examples for String:String Function

Description

Use gets_s() and puts() functions to read and output string

Demo Code

#include <stdio.h>

#define STLEN 81/*from  w w  w . j  a v  a  2s .  co  m*/

int main(void){

    char words[STLEN];
     
    puts("Enter a string, please.");
    gets_s(words);  // typical use
    printf("Your string twice:\n");
    printf("%s\n", words);
    puts(words);
    puts("Done.");
    
    return 0;
}

Result


Related Tutorials