hmwk4 - printf( "The list of your words...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#define LEN 10 #define MAXSTR 1024 void flip_n_place (char arr2[][MAXSTR], char arr3[][MAXSTR], int size); //void alpha_n_place (char arr1[][MAXSTR], int size); int main() { char alpha1[LEN][MAXSTR]; char flip2[LEN][MAXSTR]; char flip3[LEN][MAXSTR]; //char array4[LEN][MAXSTR]; char array5[LEN][MAXSTR]; char end = '3'; char temp[MAXSTR]; int size = 0; int i; for ( i = 0; i < LEN; i++ ) { printf( "Enter a string: " ); scanf( "%s",temp ); if ( temp[0] != end ) { strcpy(alpha1[i], temp); //strcpy(array4[i], array2[i]); strcpy(flip2[i], alpha1[i]); size++; } else break; } flip_n_place( flip2, flip3, size); printf("The list of your words flipped in place: \n" ); for ( i=0; i < size; i++) printf("%s\n", flip2[i]); /*alpha_n_place (alpha1, size);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf( &quot;The list of your words aplabetized in place: \n&quot;); for ( i=0; i &lt; size; i++) printf(&quot;%s\n&quot;, alpha1[i]);*/ } void flip_n_place (char arr2[MAXSTR], char arr3[MAXSTR], int size) { int i; for(i= 0; i &lt; size; i++) { strcpy(arr2[size-1-i], arr3[i]); } } /*void sort ( char arr1[MAXSTR], int size) { int i = 0; int j = 0; char temp [MAXSTR]; for( i = 0; i &lt; size; ++i) { for( j = i + 1; j &lt; size; ++j) { if(strcmp( arr1[i], arr1[j]) &gt; 0) { strncpy(temp, arr1[i], MAXSTR); strncpy(arr1[i], arr1[j], MAXSTR); strncpy(arr1[j], temp, MAXSTR); } } } } void alpha_n_place ( char arr1[MAXSTR], int size) { sort (arr1,size); //strncpy ( strg, arr1[0], MAXSTR); } */...
View Full Document

This note was uploaded on 02/28/2012 for the course ECO 4701 taught by Professor Ahmed during the Spring '11 term at Andhra University.

Page1 / 2

hmwk4 - printf( &amp;amp;quot;The list of your words...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online