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
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
FREE SEO Check & Google Maps Check for Sri Lankan Businesses | Web Design, Website Price Rs 14,900 |
LankaSolve
Updated:
Oct 20, 2026
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Oct 17, 2026
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Oct 14, 2026
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Oct 12, 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