Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Tuesday at 10:28 AM
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Monday at 2:42 PM
Ad icon
Professional CCTV Installation Service
Techguy231
Updated:
Sunday at 10:50 AM
Ad icon
I'll research & write an article - Rs. 2000 onwards
Blogerwiki
Updated:
Sep 3, 2026
House Plan
lenura
Updated:
Sep 2, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Need Help in 'C'
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="x-pert" data-source="post: 3978146" data-attributes="member: 837"><p>PM ekata answer eka methana dennam machang ooni kenekta balaaganna and mama waradi nam danna kenekta hadanna </p><p></p><p>Problem of the below: </p><p></p><p>[CODE]#include <stdio.h></p><p># include <string.h></p><p></p><p>main()</p><p></p><p>{</p><p></p><p>int i,m,n,count;</p><p>char str[10],rev_str[10];</p><p></p><p>printf("Enter a String :");</p><p>gets(str);</p><p></p><p>for(i=0;str[i]!='\0';i++)</p><p>{</p><p></p><p>}</p><p></p><p>m=i;</p><p>n=i;</p><p>for(i;i>0;i--)</p><p> {</p><p></p><p> rev_str[n-i]=str[i]; </p><p></p><p>[B][COLOR=DarkGreen]// Logic is a little bit wrong machang as I can see. </p><p>// Let's go in to the loop</p><p>// step 1: for i; i>0; i-- </p><p>// Let's say the array size is 6. So condition, i > 0 satisfies.</p><p>// Then i-- = 5</p><p>// Then, rev_str[6-5] = str[i] Which means, rev_str[1] = str[5]</p><p></p><p>//Second loop</p><p>// now i = 5. </p><p>// So rev_str[6-4] = str[4] Which means, rev_str[2] = str[4] </p><p></p><p>// and so on...</p><p></p><p>// So what happens to the first item of the array? (rev_str[0]?)[/COLOR][/B] </p><p></p><p></p><p> }</p><p></p><p></p><p>printf("new: %s",rev_str);</p><p></p><p>}</p><p></p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="x-pert, post: 3978146, member: 837"] PM ekata answer eka methana dennam machang ooni kenekta balaaganna and mama waradi nam danna kenekta hadanna Problem of the below: [CODE]#include <stdio.h> # include <string.h> main() { int i,m,n,count; char str[10],rev_str[10]; printf("Enter a String :"); gets(str); for(i=0;str[i]!='\0';i++) { } m=i; n=i; for(i;i>0;i--) { rev_str[n-i]=str[i]; [B][COLOR=DarkGreen]// Logic is a little bit wrong machang as I can see. // Let's go in to the loop // step 1: for i; i>0; i-- // Let's say the array size is 6. So condition, i > 0 satisfies. // Then i-- = 5 // Then, rev_str[6-5] = str[i] Which means, rev_str[1] = str[5] //Second loop // now i = 5. // So rev_str[6-4] = str[4] Which means, rev_str[2] = str[4] // and so on... // So what happens to the first item of the array? (rev_str[0]?)[/COLOR][/B] } printf("new: %s",rev_str); } [/CODE] [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom