473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

please Guide me

5
#include<conio.h>
#include<stdio.h>
#include<string.h>
int main()
{
char A[40],B[40];
char ch;
int size,i,j;
puts("plese enter the string to be reversed");
gets(A);
puts(A);
ch='\0';
size=strchr(A,ch)-A;
printf("%d",size);
j=0;

for(i=size;i<0;i--)
{

B[j]=A[i];
j++;

}

puts(B);
getch();
i am trying ti reverse the string A and trying to store it in the string B but i am unable to be that is there any logical eror or some other error because no syntax error is there and i just wat to reverse the string A and want to stor it in the B using this for loop
regards
Jul 30 '07 #1
4 1300
gpraghuram
1,275 Expert 1GB
#include<conio.h>
#include<stdio.h>
#include<string.h>
int main()
{
char A[40],B[40];
char ch;
int size,i,j;
puts("plese enter the string to be reversed");
gets(A);
puts(A);
ch='\0';
size=strchr(A,ch)-A;
printf("%d",size);
j=0;

for(i=size;i<0;i--)
{

B[j]=A[i];
j++;

}

puts(B);
getch();
i am trying ti reverse the string A and trying to store it in the string B but i am unable to be that is there any logical eror or some other error because no syntax error is there and i just wat to reverse the string A and want to stor it in the B using this for loop
regards
Hi,
Problem is with the for loop u have used it shuld be
for(i=size;i<0;i--) ///previously i<0
What u can do is get the string length and initialize the size variable instead of strchr

Thanks
Raghuram.
Jul 30 '07 #2
iaslam
5
i have again check it but still the same problem persists
Jul 30 '07 #3
gpraghuram
1,275 Expert 1GB
i have again check it but still the same problem persists
CHek this one
Expand|Select|Wrap|Line Numbers
  1. #include<conio.h>
  2. #include<stdio.h>
  3. #include<string.h>
  4. int main()
  5. {
  6. char A[40],B[40];
  7. char ch;
  8. int size,i,j;
  9. puts("plese enter the string to be reversed");
  10. gets(A);
  11. puts(A);
  12. ch='\0';
  13. //size=strchr(A,ch)-A;
  14. size=strlen(A);
  15. printf("%d",size);
  16. j=0;
  17.  
  18. for(i=size;i>0;i--)
  19. {
  20.  
  21. B[j]=A[i];
  22. j++;
  23.  
  24.  
  25.  
Raghuram
Jul 30 '07 #4
iaslam
5
thanks dear
regards
Jul 30 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sjaakie | last post by:
Hi there, I'm trying to get HTML_ToPDF (3.3) running on en dedicated server, safe_mode enabled. Been trying for more than 2 days now, without success. Have similar script running on my own...
3
by: Kanv | last post by:
Hi, I would shortly be working on DB2 UDB 8.1.2. I have no prior DB2 experience and need to be involved in the installation, maintainence and tuning of the database. Could you please...
7
by: cw | last post by:
I am totally new to MS Access 2000. Can anyone please recommend a good beginners' guide book or web site? TIA.
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
32
by: Tom Cole | last post by:
I bet 50% of the posts I've read lately have had at least one bad thing to say about every website or book dedicated to javascript. There are clearly a few posters (you know who you are) who...
12
by: Simon | last post by:
Hi all, I'm having a baffling problem with a windows service that I'm working on. Basically, I am using a typed dataset to insert a large number of rows into an SQL Server 2005 database. But...
0
by: imranabdulaziz | last post by:
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End I generated local mode report but as there was no printing option available . I assign...
3
by: Har | last post by:
I have created a small client application with loopback address (127.0.0.1) so that same machine act as server and client. but i want to know whether we have to create seperate server application and...
3
by: phanimadhav | last post by:
Hi, i am working on the coding part which is based on jsp/html.As im fresher i am facing some problems with the code.so,can u please guide me..This is the error which i ve got...please have a...
3
by: madankarmukta | last post by:
Hi All, I am facing one problem while implementing the connectivity with the sybase server. When I am trying to open the AseConnection object the error popped up is "Client unable to establish a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.