Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

snprintf c

// C program to demonstrate snprintf()
#include <stdio.h>
 
int main()
{
    char buffer[50];
    char* s = "geeksforgeeks";
 
    // Counting the character and storing
    // in buffer using snprintf
    int j = snprintf(buffer, 6, "%s
", s);
 
    // Print the string stored in buffer and
    // character count
    printf("string:
%s
character count = %d
",
                                     buffer, j);
 
    return 0;
}
Source by fr.acervolima.com #
 
PREVIOUS NEXT
Tagged: #snprintf
ADD COMMENT
Topic
Name
4+4 =