Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

C program to use string handling functions

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program to use string handling functions in C Programming with practical program code and step-by-step full complete explanation.

C Program to use string handling functions

C Program to use string handling functions.

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

void main()
{
    char s1[20],s2[20],s3[20];
    int x,l1,l2,l3;

    printf("Enter two string constantsn");
    printf("?");

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

    x=strcmp(s1,s2);

    if(x!=0)
    {

        printf("nString are not equal");
        strcat(s1,s2);
    }
    else
        printf("nString are equal");

    strcpy(s3,s1);
    l1=strlen(s1);
    l2=strlen(s2);
    l3=strlen(s3);

    printf("ns1=%s length=%d characters",s1,l1);
    printf("ns2=%s length=%d characters",s2,l2);
    printf("ns3=%s length=%d characters",s3,l3);
}

Output

 
Enter two string constants
? ananda murugan

Strings are not equal
S1=ananda murugan length=13 characters
S2=murugan length=7 characters
S3=ananda murugan length=13 characters

Enter two string constants
? anand anand
String are equal
S1=anand length=5 characters
S2=anand length=5 characters
S3=anand length=5 characters
c coding problems

Post navigation

Previous post
Next post
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
  • Hackerrank Day 14 scope 30 days of code solution
©2025 Programming101 | WordPress Theme by SuperbThemes