answersLogoWhite

0


Best Answer

void main()

{char a[30] = "India";

//Let the string be stored in a[30];

char b[30]; //declaring another string

for(i=0;i<strlen(a);i++)

{b[strlen(a)-1 - i]=a[i];}

//Now reverse string is stored in b;

//to print it

cout<<b;

getch();

}

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

#include <stdio.h>

main ()

{

int i=0,k=0,j;

char a[30],b[30];

printf("\nEnter the string:\n");

gets(a);

while(a[i++]!='\0')

k++;

for (i = 0,j=k-1; i <k,j>=0 ; i++,j--)

b[i] = a[j];

printf("%s",b);

return(0);

}

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

Parse the string, word by word, left-to-right, pushing each word onto a stack. When you reach the end of the string, clear it (make it empty), then begin popping words from the stack and appending them to the string. When the stack is empty, the words in the string will be in the reverse order.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

I'd use a simple loop.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How would you write a program that takes a string of characters and reverses them in the C programming language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is there a program that can help you make a programming language but you don't need to know a programming language?

No. In order to make or use a program or a programming language, you need to know a programming language.


What is the work of compiler?

A compiler converts a program in one programming language into a program in another programming language. Often the conversion is into a language that can be understood directly by the hardware.


A common program language?

Yes, C is a common programming language.


Which program uses actionscript as its programming language?

Adobe Flash uses actionscript. It is the main programming language for flash.


Why do you have program language?

Because if we did not then it would be D programming


Is COBOL an application program?

No, COBOL is a programming language.


Why program in c language?

It is the most common programming language, but of course there are many others. It is one of the easiest computer programming.


What program does prolog belong to?

Prolog does not belong to any program, it is a programming language.


What has the author Carl Feingold written?

Carl Feingold has written: 'Fundamentals of COBOL programming' -- subject(s): COBOL (Computer program language) 'RPG II programming' -- subject(s): RPG (Computer program language) 'Fundamentals of structured COBOL programming' -- subject(s): COBOL (Computer program language), Structured programming


Technology and programming language?

program means set of statements.and coming to programming languages , the program which is developed in any language i.e c,c++,java etc


What has the author Bryan Meyers written?

Bryan Meyers has written: 'Desktop guide to CL programming' -- subject(s): Job Control Language (Computer program language), Programming, IBM computers 'RPG IV jump start' -- subject(s): RPG IV (Computer program language) 'Control language programming for the AS/400' -- subject(s): IBM AS/400 (Computer), Programming, Job Control Language (Computer program language)


What are the differences between program and program language?

Programming [verb] is a process done by software engineers or computer programmers consisting of the following steps: customer requirements analysis, software design, coding the design using a programming language, testing and debugging the program parts, program integration, testing and debugging the complete program, and customer acceptance testing. Any bugs found during the two testing steps of the programming process will have to be fixed in the code written in the programming language and all necessary testing steps repeated.A programming language [noun] (you wrote program language) is a human readable language used by software engineers or computer programmers during the coding step of the programming process. The code written in the programming language is then converted by a translator program (e.g. compiler, assembler) to machine code that the target computer can "understand" and run.