Demonstrates strrev(), strset(), and strnset(). - C String

C examples for String:String Function

Description

Demonstrates strrev(), strset(), and strnset().

Demo Code

#include <stdio.h>
#include <string.h>

char str[] = "This is the test string.";

int main( void )
{
    printf("\nThe original string: %s", str);
    printf("\nCalling strrev(): %s", strrev(str));
    printf("\nCalling strrev() again: %s", strrev(str));
    printf("\nCalling strnset(): %s", strnset(str, '!', 5));
    printf("\nCalling strset(): %s", strset(str, '!'));
    return 0;/*  w w w .  ja v  a 2 s.  c o  m*/
}

Result


Related Tutorials