Join Our Email Alerts-Subscribe
Important Note:Login & Check Your Email Inbox and Activate Confirmation Link



Enter Your Email :

Copyright Disclaimer:
Section 107 of the Copyright Act Fair Use Contents .
We are forwarding content link(s) from our website to content website & We are not serving any contents.
Main Source:Google.com.All the Content PDF link(s) is/are obtained from GoogleSearch
for the purpose of Education & Teaching Intention. Not for commercial purpose.
Technicalsymposium.com is not liable/responsible for any copyright issues.

Data Structure Programming Source Codes & Study Notes-Free Download


DataStructure-Program to perform some basic operations on string.

#include <stdio.h>
#include <conio.h>
#include <string.h>
int xstrlen ( char * ) ;
void xstrcpy ( char *, char * ) ;
void xstrcat ( char *, char * ) ;
int xstrcmp ( char *, char * ) ;
void show ( char * ) ;
void main( )
{
char s1[ ] = "kicit" ;
char s2[ ] = "Nagpur" ;
char s3[20] ;
int len ;
clrscr( ) ;
printf ( "\nString s1: %s", s1 ) ;
len = xstrlen ( s1 ) ;
printf ( "\nlength of the string s1: %d", len ) ;
printf ( "\nString s2: %s", s2 ) ;
xstrcpy ( s3, s1 ) ;
printf ( "\nString s3 after copying s1 to it: %s", s3 ) ;
xstrcat ( s3, s2 ) ;
printf ( "\nString s3 after concatenation: %s", s3 ) ;
if ( xstrcmp ( s1, s2 ) == 0 )
printf ( "\nThe strings s1 and s2 are similar" ) ;
else
printf ( "\nThe strings s1 and s2 are not similar" ) ;
getch( ) ;
}
/* finds the length of the string */
int xstrlen ( char *s )
{
int l = 0 ;
while ( *s )
{
l++ ;
s++ ;
}
return l ;
}
/* copies source string s to the target string t */
void xstrcpy ( char *t, char *s )
{
while ( *s )
{
*t = *s ;
t++ ;
s++ ;
}
*t = '\0' ;
}
/* concatenates the two strings */
void xstrcat ( char *t, char *s )
{
while ( *t )
t++ ;
while ( *s )
*t++ = *s++ ;
*t = '\0' ;
}
/* compares two strings s and t for equality */
int xstrcmp ( char *s, char *t )
{
while ( *s == *t )
{
if ( ! ( *s ) )
return 0 ;
s++ ;
t++ ;
}
return ( *s - *t ) ;
}

 


Technicalsymposium.com-Free Study Materials PDF-Download




Technicalsymposium.com-Download All Study Notes PDF




Technicalsymposium.com-Free Live Support-Chat with Our Experts

Official Contact: +91-9245556793 (Whatsapp Message / SMS / Voice Call)


Our Expert team is ready to answer all your questions immediately-Feel free to speak in Tamil/English.

(Example:Events info/Lecture Notes/Off-Campus & All Jobs/Projects & All education information)

Working hrs (IST): (Morning: 10:00AM-3:00 PM) and (Evening:5:00 PM to 10:00 PM)

All Latest Question & Answer Page (FAQ)-Click here