Computers & Internet Logo

Related Topics:

Posted on Mar 01, 2011
Answered by a Fixya Expert

Trustworthy Expert Solutions

At Fixya.com, our trusted experts are meticulously vetted and possess extensive experience in their respective fields. Backed by a community of knowledgeable professionals, our platform ensures that the solutions provided are thoroughly researched and validated.

View Our Top Experts

Define a character array and use strcpy() to copy a string into it. Print the string out by using a loop with a pointer to print out one character at a time. Initialize the pointer to the first element and use the double plus sign to increment the pointer. Use a separate integer variable to count the characters to print. Modify the program from programming exercise 1 to print out the string backwards by pointing to the end and using a decrementing pointer.

1 Answer

Anonymous

Level 2:

An expert who has achieved level 2 by getting 100 points

All-Star:

An expert that got 10 achievements.

MVP:

An expert that got 5 achievements.

Sergeant:

An expert that has over 500 points.

  • Expert 233 Answers
  • Posted on Mar 01, 2011
Anonymous
Expert
Level 2:

An expert who has achieved level 2 by getting 100 points

All-Star:

An expert that got 10 achievements.

MVP:

An expert that got 5 achievements.

Sergeant:

An expert that has over 500 points.

Joined: Feb 28, 2011
Answers
233
Questions
0
Helped
71455
Points
742

Nice, computer science homework.
int main () { char str[]="this is my string";
//print our string forwards int i = 0; while(str[i]!="\0") { putchar( str[i] ); i++; }
//newline putchar('\n');
//print our string backwards int length = strlen(str); while(length--) { putchar( str[length] ); } }
I didn't test this to make sure it worked, but this is the general way of doing this. It looks like your professor wants you to use pointers. I used pointers here. Do you know how? Arrays are pointers with some syntactic sugar.
I wouldn't rely on sites like this to get answers to your homework. Even if you get the right answer, there's always the possibility of your CS professor finding this answer online and then making your future homework ten times harder.

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

167 views

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

ADMIN Andrew
ADMIN Andrew

Level 3 Expert

73787 Answers

ADMIN Eric
ADMIN Eric

Level 3 Expert

42236 Answers

Brad Brown

Level 3 Expert

19190 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...