<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>String operation | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/string-operation/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 10 Dec 2022 04:23:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>String Operation</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/string-operation/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/string-operation/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Tue, 25 Oct 2022 08:24:43 +0000</pubDate>
				<category><![CDATA[C Tutorials]]></category>
		<category><![CDATA[String operation]]></category>
		<category><![CDATA[strcat]]></category>
		<category><![CDATA[strcpy]]></category>
		<category><![CDATA[strcmp]]></category>
		<category><![CDATA[strrev]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9681</guid>

					<description><![CDATA[<p>The functions in the C string handling library can be used to manage strings. String operations are carried out using the string.h library. It offers a number of functions for working with strings. Several frequently used string handling functions are listed below: Strcat() is a function that joins the end of the source and destination</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/string-operation/">String Operation</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>The functions in the C string handling library can be used to manage strings. String operations are carried out using the string.h library. It offers a number of functions for working with strings.</p>



<p>Several frequently used string handling functions are listed below:</p>



<ul><li><strong>Strcat() </strong>is a function that joins the end of the source and destination strings together. The base addresses of the source string and the target string are the first two parameters this method expects. For instance, the string &#8220;HelloWorld&#8221; would be produced by concatenating the words &#8220;Hello&#8221; and &#8220;World.&#8221;</li></ul>



<p>The strcat() function can be used as shown below:</p>



<pre class="wp-block-code"><code class="">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
int main()
{
    char s[] = "Hello";
    char t[] = "World";
    strcat(s, t);
    printf("String = %s", s);
}</code></pre>



<p>Output</p>



<p>String&nbsp; = HelloWorld</p>



<ul><li>T<strong>he strlen() </strong>method counts the amount of characters in a string.</li></ul>



<p>The strlen() method can be used as shown below:</p>



<pre class="wp-block-code"><code lang="c" class="language-c">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
int main()
{
    char s[] = "Hello";
    int len = strlen(s);
    printf("Length = %d", len);
}</code></pre>



<p>Output:</p>



<p>Length&nbsp; = 5</p>



<ul><li><strong>The strcpy() </strong>method copies the data from one string into another. The base addresses of the source string and the target string are the first two parameters this method expects.</li></ul>



<p>The strcpy() method can be used in the following ways:</p>



<pre class="wp-block-code"><code lang="c" class="language-c">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
int main()
{
    char s[] = "studentproject";
    char t[50];
    strcpy(t, s);
    printf("Source string = %s\n", s);
    printf("Target string = %s", t);
}</code></pre>



<p>Output:</p>



<p>Source string&nbsp; = studentproject</p>



<p>Target string&nbsp; = studentproject</p>



<ul><li><strong>strcmp() </strong>This function compares two strings to determine whether they are identical or dissimilar. It accepts two strings as parameters. Character by character, it will compare two strings until it finds a discrepancy or reaches the end of one of the strings.A value of zero is returned by strcmp() if the strings are identical. If the two strings are not identical, it will return a number that is less than zero because the mismatched character in the first string has a lower ASCII value than the mismatched character in the second. Otherwise, a value other than 0 will be returned.</li></ul>



<p>The strcmp() function can be utilised as shown below:</p>



<pre class="wp-block-code"><code class="">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
int main()
{
    char s[] = "Hello";
    char t[] = "World";
    int cmp = strcmp(s, t);
    printf("Comparison result = %d", cmp);
}</code></pre>



<p>Output:</p>



<p>Comparison result = -1</p>



<ul><li><strong>strrev()</strong> This function is used to return the reverse of the string. Here is how we can use the strrev( ) function:</li></ul>



<pre class="wp-block-code"><code class="">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
int main()
{
    char s[] = "project";
    printf("Reversed string = %s", strrev(s));
}</code></pre>



<p>Output:</p>



<p>Reversed string&nbsp; = tcejorp</p><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/string-operation/">String Operation</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/string-operation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
