Question
Asked by:
Amantes
Amantes
Rating : No Rating
Questions Asked: 6
Tutorials Posted: 0
 

$1.00 Using pointers in C

Q:
Write a program to read in 6 strings from the keyboard, and then print them in reverse order on the
screen, using the following directions.
“Reverse order” means that if you enter six words, the sixth word will be printed first, the fifth will be
printed second, and so on.
The strings will be stored in an array of 6 char pointers. The array should be declared as:
char *str_array[6];
This type of array only stores pointers to a string, and not the strings themselves. You must allocate space
for each string using malloc.
 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
rainman
rainman
Rating (40): A+
Questions Asked: 2
Tutorials Posted: 174, earned $906.64
 

$5.00 C Program To Get 6 Strings From User And Print Them In Reverse Order. Compiled, Commented, Tested, Works

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on Mar 02, 2009 at 5:25:44PM
A:
Preview: ... har *str_array[6];<br><br> char buffer[128]; //buffer to hold the input<br><br> //loop 6 times for 6 words<br> int i;<br> for (i = 0; i < 6; i++)<br> {<br> printf("Enter string %d: ", i + 1);<br> scanf("%s", buffer);<br><br> ...

The full tutorial is about 277 words long plus attachments.

Attachments:
main.c (1K) (Preview)
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty