<?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>electrofriends.com &#187; String Programs</title>
	<atom:link href="http://electrofriends.com/category/source-codes/software-programs/c/string-programs/feed/" rel="self" type="application/rss+xml" />
	<link>http://electrofriends.com</link>
	<description>...bringing innovative minds together</description>
	<lastBuildDate>Fri, 11 May 2012 08:44:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Program to replace each string of one or more blanks by a single blank</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-replace-string-blanks-single-blank-2/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-replace-string-blanks-single-blank-2/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 13:06:31 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[replace bank]]></category>
		<category><![CDATA[string programs]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=2151</guid>
		<description><![CDATA[Here is the program to replace each string of one or more blanks by a single blank. #include &#8220;stdio.h&#8221; #include &#8220;conio.h&#8221; #include &#8220;string.h&#8221; void main() { char input[100],output[100],c; int i=0,j=0; clrscr(); printf(&#8220;Enter the string\n&#8221;); gets(input); for(i=0;i&#60;strlen(input);i++) { if(input[i]==&#039; &#039;&#38;&#38;input[i+1]!=&#039; &#039;) output[j++]=input[i]; else if(input[i]!=&#039; &#039;) output[j++]=input[i]; } output[j]=&#039;&#039;; printf(&#34;\noutput string is\n&#34;); puts(output); getch(); } Output: Enter [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the program to replace each string of one or more blanks by a single blank.</p>
<p>#include &#8220;stdio.h&#8221;<br />
#include &#8220;conio.h&#8221;<br />
#include &#8220;string.h&#8221;<br />
void main()<br />
{<br />
 char input[100],output[100],c;<br />
 int i=0,j=0;<br />
 clrscr();<br />
 printf(&#8220;Enter the string\n&#8221;);<br />
 gets(input);<br />
 for(i=0;i&lt;strlen(input);i++)<br />
 {<br />
  if(input[i]==&#039; &#039;&amp;&amp;input[i+1]!=&#039; &#039;)<br />
  output[j++]=input[i];<br />
  else if(input[i]!=&#039; &#039;)<br />
  output[j++]=input[i];<br />
 }<br />
 output[j]=&#039;&#039;;<br />
 printf(&quot;\noutput string is\n&quot;);<br />
 puts(output);<br />
 getch();<br />
}</p>
<p><strong>Output:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Enter the string
How          are                 you         <span style="color: #339933;">?</span>
Output string is<span style="color: #339933;">:</span>
How are you <span style="color: #339933;">?</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-replace-string-blanks-single-blank-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program to match two given strings using function</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-match-strings-function/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-match-strings-function/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 12:21:28 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[matchany]]></category>
		<category><![CDATA[string compare]]></category>
		<category><![CDATA[string match]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=2139</guid>
		<description><![CDATA[This is the program which makes use of function matchany(s1,s2) which returns the first location in the string s1 where any character from the string s2 occurs, or -1 if s1 contains no character from s2. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [...]]]></description>
			<content:encoded><![CDATA[<p>This is the program which makes use of function matchany(s1,s2) which returns the first location in the string s1 where any character from the string s2 occurs, or -1 if s1 contains no character from s2.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;stdio.h&quot;</span>
<span style="color: #339933;">#include &quot;conio.h&quot;</span>
<span style="color: #339933;">#include &quot;string.h&quot;</span>
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #993333;">int</span> matchany<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> str1<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #993333;">char</span> str2<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//function declaration</span>
 <span style="color: #993333;">char</span> str1<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">50</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>str2<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">50</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #993333;">int</span> s<span style="color: #339933;">;</span>
 clrscr<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter string 1 and string 2<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s%s&quot;</span><span style="color: #339933;">,&amp;</span>str1<span style="color: #339933;">,&amp;</span>str2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 s<span style="color: #339933;">=</span>matchany<span style="color: #009900;">&#40;</span>str1<span style="color: #339933;">,</span>str2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>s<span style="color: #339933;">==-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>No match found&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">else</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>The location where the first match occured is %d&quot;</span><span style="color: #339933;">,</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> matchany<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> str1<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #993333;">char</span> str2<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #993333;">int</span> i<span style="color: #339933;">,</span>j<span style="color: #339933;">;</span>
 <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>strlen<span style="color: #009900;">&#40;</span>str2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>j<span style="color: #339933;">&lt;</span>strlen<span style="color: #009900;">&#40;</span>str1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>str2<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span>str1<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> j<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>output 1:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Enter string <span style="color: #0000dd;">1</span> and string <span style="color: #0000dd;">2</span>
hello
world
The location where the first match occured is <span style="color: #0000dd;">5</span></pre></div></div>

<p><strong>Output 2:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Enter string <span style="color: #0000dd;">1</span> and string <span style="color: #0000dd;">2</span>
ice
smooth
No match found</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-match-strings-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program to arrange the string in alphabetical order</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-arrange-string-alphabetical-order/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-arrange-string-alphabetical-order/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 14:24:39 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[alphabetical]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[sorting]]></category>
		<category><![CDATA[string programs]]></category>
		<category><![CDATA[string sorting]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1769</guid>
		<description><![CDATA[Here is the program to arrange the string in alphabetical order. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #include &#34;stdio.h&#34; #include &#34;conio.h&#34; #include &#34;string.h&#34; void main&#40;&#41; &#123; char str&#91;10&#93;,temp; int i,j; clrscr&#40;&#41;; printf&#40;&#34;\nEnter the string : &#34;&#41;; scanf&#40;&#34;%s&#34;,str&#41;; for&#40;i=0;i&#60;strlen&#40;str&#41;;i++&#41; for&#40;j=0;j&#60;strlen&#40;str&#41;;j++&#41; if&#40;str&#91;i&#93;&#60;str&#91;j&#93;&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the program to arrange the string in alphabetical order.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">  <span style="color: #339933;">#include &quot;stdio.h&quot;</span>
  <span style="color: #339933;">#include &quot;conio.h&quot;</span>
  <span style="color: #339933;">#include &quot;string.h&quot;</span>
  <span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
     <span style="color: #993333;">char</span> str<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>temp<span style="color: #339933;">;</span>
     <span style="color: #993333;">int</span> i<span style="color: #339933;">,</span>j<span style="color: #339933;">;</span>
     clrscr<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Enter the string : &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span>str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>strlen<span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
       <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>j<span style="color: #339933;">&lt;</span>strlen<span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
	 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">&lt;</span>str<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
	 <span style="color: #009900;">&#123;</span>
	   temp <span style="color: #339933;">=</span> str<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	   str<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> str<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	   str<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> temp<span style="color: #339933;">;</span>
	 <span style="color: #009900;">&#125;</span>
     <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Reversed String is : %s&quot;</span><span style="color: #339933;">,</span>str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-arrange-string-alphabetical-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program to delete n Characters from a given position in a given string using functions</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-delete-characters-position-string-functions/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-delete-characters-position-string-functions/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 09:39:37 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[delete characters]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[string programs]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1750</guid>
		<description><![CDATA[This C program uses function delchar to delete n characters from a given position in a given string. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #include &#34;stdio.h&#34; #include &#34;conio.h&#34; #include &#34;string.h&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>This C program uses function delchar to delete n characters from a given position in a given string.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;stdio.h&quot;</span>
<span style="color: #339933;">#include &quot;conio.h&quot;</span>
<span style="color: #339933;">#include &quot;string.h&quot;</span>
&nbsp;
<span style="color: #993333;">void</span> delchar<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>x<span style="color: #339933;">,</span><span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #993333;">char</span> string<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
     <span style="color: #993333;">int</span> n<span style="color: #339933;">,</span>pos<span style="color: #339933;">,</span>p<span style="color: #339933;">;</span>
     clrscr<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     puts<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter the string&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     gets<span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter the position from where to delete&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,&amp;</span>pos<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter the number of characters to be deleted&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,&amp;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     delchar<span style="color: #009900;">&#40;</span>string<span style="color: #339933;">,</span> n<span style="color: #339933;">,</span>pos<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Function to delete n characters</span>
<span style="color: #993333;">void</span> delchar<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>x<span style="color: #339933;">,</span><span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">+</span>b<span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> strlen<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    strcpy<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>x<span style="color: #009900;">&#91;</span>b<span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,&amp;</span>x<span style="color: #009900;">&#91;</span>a<span style="color: #339933;">+</span>b<span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    puts<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/program-delete-characters-position-string-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To reverse the given string using pointer</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-reverse-the-given-string-using-pointer/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-reverse-the-given-string-using-pointer/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 09:18:53 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=412</guid>
		<description><![CDATA[This is the program to reverse the given string and display. The program internally uses the logic of reversing the word. Logic: The approach here is to reverse the string using the pointers. Reversing the string includes the reversing the each and every words in it. After accepting a string from user, it calls a [...]]]></description>
			<content:encoded><![CDATA[<p>This is the program to reverse the given string and display. The program internally uses the logic of reversing the word.</p>
<p>Logic: The approach here is to reverse the string using the pointers. Reversing the string includes the reversing the each and every words in it. After accepting a string from user, it calls a function &#8220;strev&#8221; with two string pointer arguments, the source and destination. It has an iterative loop, which traces from the EOL through the beginning. Each time it copies the current letter to the destination. Finally it displays the resultant string.</p>
<p>The earlier program implements the same by direct method, i.e. without pointers.</p>
<pre>#include&lt;stdio.h&gt;
#include&lt;conio.h&gt;
void strev(char *str1, char *str2);
void main()
{
        char *str1, *str2;
        clrscr();
        printf("\n\n\t ENTER A STRING...: ");
        gets(str1);
        strev(str1,str2);
        printf("\n\t THE REVERSED STRING IS...: ");
        puts(str2);
        getch();
}

void strev(char *str1, char *str2)
{
        int i = 0, len = 0, r = 0;
        while(*(str1+len)!='\0')
                len++;
        for(i=len-1; i&gt;=0; i--)
        {
                *(str2+r) = *(str1+i);
                r++;
        }
        *(str2+r) = '\0';
}</pre>
<p><a href="http://electrofriends.com/wp-content/uploads/2008/12/strp_rev.zip"><img class="size-medium wp-image-443" title="String Reverse C program" src="http://electrofriends.com/wp-content/uploads/2009/02/download_icon.gif" border="0" alt="" width="131" height="53" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-reverse-the-given-string-using-pointer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>To reverse the given string</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-reverse-the-given-string/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-reverse-the-given-string/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 09:15:40 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=409</guid>
		<description><![CDATA[Here is the program to reverse the given string and display. The program internally uses the logic of reversing the word. Logic: Reversing the string includes the reversing the each and every words in it. After accepting a string from user, it calls a function &#8220;strev&#8221; with two string arguments, the source and destination. It [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the program to reverse the given string and display. The program internally uses the logic of reversing the word.</p>
<p>Logic: Reversing the string includes the reversing the each and every words in it. After accepting a string from user, it calls a function &#8220;strev&#8221; with two string arguments, the source and destination. It has an iterative loop, which traces from the EOL through the begining. Each time it copies the current letter to the destination. Finally it displays the resultant string.</p>
<p>The same program is implemented using the string pointers.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
void strev(char str1[50], char str2[50]);<br />
void main()<br />
{<br />
char str1[50], str2[50];<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER A STRING&#8230;: &#8220;);<br />
gets(str1);<br />
strev(str1,str2);<br />
printf(&#8220;\n\t THE REVERSED STRING IS&#8230;: &#8220;);<br />
puts(str2);<br />
getch();<br />
}<br />
void strev(char str1[50], char str2[50])<br />
{<br />
int i = 0, len = 0, r = 0;<br />
while(str1[len]!=&#8217;\0&#8242;)<br />
len++;<br />
for(i=len-1; i&gt;=0; i&#8211;)<br />
{<br />
str2[r] = str1[i];<br />
r++;<br />
}<br />
str2[r] = &#8216;\0&#8242;;<br />
}<br />
<a href="http://electrofriends.com/wp-content/uploads/2008/12/str_rev.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-reverse-the-given-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To copy the contents of one string to another string using pointer</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-copy-the-contents-of-one-string-to-another-string-using-pointer/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-copy-the-contents-of-one-string-to-another-string-using-pointer/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 09:07:10 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=405</guid>
		<description><![CDATA[This is the simple implementation of the &#8220;Copy&#8221; function using the pointers. This program copies the content of one string to another. Logic : The program asks the user to input the string to copy and stores using the pointer str1. The inner function &#8220;stcpy&#8221; takes 2 string pointers as arguments. By keeping the length [...]]]></description>
			<content:encoded><![CDATA[<p>This is the simple implementation of the &#8220;Copy&#8221; function using the pointers. This program copies the content of one string to another.</p>
<p>Logic : The program asks the user to input the string to copy and stores using the pointer str1. The inner function &#8220;stcpy&#8221; takes 2 string pointers as arguments. By keeping the length as the reference, it traces till EOF , for each i of this iteration it copies the i-th  letter to the destination string, i.e str2. After the EOL, it puts a NULL to the second line. That gives the duplicated string of the entered.</p>
<p>This function copies the string using the pointer, where earlier program copies the string directly.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
void stcpy(char *str1, char *str2);<br />
void main()<br />
{<br />
char *str1, *str2;<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER A STRING&#8230;: &#8220;);<br />
gets(str1);<br />
stcpy(str1,str2);<br />
printf(&#8220;\n\t THE COPIED STRING IS&#8230;: &#8220;);<br />
puts(str2);<br />
getch();<br />
}<br />
void stcpy(char *str1, char *str2)<br />
{<br />
int i, len = 0;<br />
while(*(str1+len)!=&#8217;\0&#8242;)<br />
len++;<br />
for(i=0;i&lt;len;i++)<br />
*(str2+i) = *(str1+i);<br />
*(str2+i) = &#8216;\0&#8242;;<br />
}<br />
<a href="http://electrofriends.com/wp-content/uploads/2008/12/strp_cpy.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-copy-the-contents-of-one-string-to-another-string-using-pointer/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>To copy the contents of one string to another string</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-copy-the-contents-of-one-string-to-another-string/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-copy-the-contents-of-one-string-to-another-string/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 09:04:07 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=402</guid>
		<description><![CDATA[This is the simple implementation of the &#8220;Copy&#8221; function of the computer world. This program copies the content of one string to another. Logic : The program asks the user to input the string to copy and stores this as str1. The inner function &#8220;stcpy&#8221; takes 2 strings as arguments. By keeping the length as [...]]]></description>
			<content:encoded><![CDATA[<p>This is the simple implementation of the &#8220;Copy&#8221; function of the computer world. This program copies the content of one string to another.</p>
<p>Logic : The program asks the user to input the string to copy and stores this as str1. The inner function &#8220;stcpy&#8221; takes 2 strings as arguments. By keeping the length as the reference, it traces till EOL , for each i of this iteration, it copies the i-th  letter to the destination string, i.e str2.</p>
<p>After the EOL, it puts a NULL to the second line. That gives the duplicated string of the entered.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
void stcpy(char str1[50], char str2[50]);<br />
void main()<br />
{<br />
char str1[50], str2[50];<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER A STRING&#8230;: &#8220;);<br />
gets(str1);<br />
stcpy(str1,str2);<br />
printf(&#8220;\n\t THE COPIED STRING IS&#8230;: &#8220;);<br />
puts(str2);<br />
getch();<br />
}<br />
void stcpy(char str1[50], char str2[50])<br />
{<br />
int i, len = 0;<br />
while(str1[len]!=&#8217;\0&#8242;)<br />
len++;<br />
for(i=0;i&lt;len;i++)<br />
str2[i] = str1[i];<br />
str2[i] = &#8216;\0&#8242;;<br />
}<br />
<a href="http://electrofriends.com/wp-content/uploads/2008/12/str_cpy.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-copy-the-contents-of-one-string-to-another-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>To check whether the given string is palindrome-method 2</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-check-whether-the-given-string-is-palindrome-method-2/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-check-whether-the-given-string-is-palindrome-method-2/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 09:00:20 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=398</guid>
		<description><![CDATA[Here is  another program, advanced version of the previous program, to check if the entered string is a palindrome. Palindrome is a string segment, which reads same from both the directions. The same method is implemented here in the program also. Logic :  The given string is referred by two names, where one is traced [...]]]></description>
			<content:encoded><![CDATA[<p>Here is  another program, advanced version of the previous program, to check if the entered string is a palindrome. Palindrome is a string segment, which reads same from both the directions. The same method is implemented here in the program also.</p>
<p>Logic :  The given string is referred by two names, where one is traced by the SOL (Start Of Line) and the other is traced from EOL (End Of Line). In every iteration, the condition is checked, if both the characters are the same. If so, sets a flag, &#8220;pal&#8221; as true (i.e. 1), and hence prints out the result.</p>
<p>The problem can also solved in another method, where we check  by reversing the string and then comparing.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
int stpal(char str[50]);<br />
void main()<br />
{<br />
char str[50];<br />
int pal;<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER A STRING&#8230;: &#8220;);<br />
gets(str);<br />
pal = stpal(str);<br />
if(pal)<br />
printf(&#8220;\n\t THE ENTERED STRING IS A PALINDROME&#8221;);<br />
else<br />
printf(&#8220;\n\t THE ENTERED STRING IS NOT A PALINDROME&#8221;);<br />
getch();<br />
}<br />
int stpal(char str[50])<br />
{<br />
int i = 0, len = 0, pal = 1;<br />
while(str[len]!=&#8217;\0&#8242;)<br />
len++;<br />
len&#8211;;<br />
for(i=0; i&lt;len/2; i++)<br />
{<br />
if(str[i] == str[len-i])<br />
pal = 1;<br />
else<br />
{<br />
pal = 0;<br />
break;<br />
}<br />
}<br />
return pal;<br />
}<br />
<a href="http://electrofriends.com/wp-content/uploads/2008/12/str_2pal.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-check-whether-the-given-string-is-palindrome-method-2/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>To check whether the given string is palindrome-method 1</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-check-whether-the-given-string-is-palindrome/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-check-whether-the-given-string-is-palindrome/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 08:57:00 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[String Programs]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=395</guid>
		<description><![CDATA[Here is  the program to check if the entered string is a palindrome or not. As we have seen in the earlier cases, Palindrome is a string segment, which reads same from both the directions. The same method is implemented here in the program also. Logic :  The given string is reversed using a method, [...]]]></description>
			<content:encoded><![CDATA[<p>Here is  the program to check if the entered string is a palindrome or not. As we have seen in the earlier cases, Palindrome is a string segment, which reads same from both the directions. The same method is implemented here in the program also.</p>
<p>Logic :  The given string is reversed using a method, which puts the reversed string in the resultant string from the EOL (End Of Line). After reversing, it compares if strings are one and the same. If so, sets a flag, &#8220;pal&#8221; as true (i.e. 1), and hence prints out the result.</p>
<p>The problem can also solved in a bit sophisticated method, where we check  without reversing the string, but directly.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
int stpal(char str1[50], char str2[50]);<br />
void main()<br />
{<br />
char str[50], rev[50];<br />
int pal;<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER A STRING&#8230;: &#8220;);<br />
gets(str);<br />
pal = stpal(str, rev);<br />
printf(&#8220;\n\t THE REVERSED STRING IS&#8230;: &#8220;);<br />
puts(rev);<br />
if(pal)<br />
printf(&#8220;\n\t THE ENTERED STRING IS A PALINDROME&#8221;);<br />
else<br />
printf(&#8220;\n\t THE ENTERED STRING IS NOT A PALINDROME&#8221;);<br />
getch();<br />
}<br />
int stpal(char str1[50], char str2[50])<br />
{<br />
int i = 0, len = 0, r = 0, pal = 1;<br />
while(str1[len]!=&#8217;\0&#8242;)<br />
len++;<br />
for(i=len-1; i&gt;=0; i&#8211;)<br />
{<br />
str2[r] = str1[i];<br />
r++;<br />
}<br />
str2[r] = &#8216;\0&#8242;;<br />
for(i=0; i&lt;=len-1; i++)<br />
{<br />
if(str1[i] == str2[i])<br />
pal = 1;<br />
else<br />
{<br />
pal = 0;<br />
break;<br />
}<br />
}<br />
return pal;<br />
}</p>
<p><a href="http://electrofriends.com/wp-content/uploads/2008/12/str_1pal.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/string-programs/to-check-whether-the-given-string-is-palindrome/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

