/* StringPointing.c (c) Kari Laitinen http://www.naturalprogramming.com/ 2013-11-25 File created. 2013-11-25 Last modification. */ #include int main() { char string_from_keyboard[ 80 ] ; char* character_in_string ; printf( "\n This program manipulates a string by using a" "\n pointer. Please, type in a string. \n\n " ) ; gets( string_from_keyboard ) ; character_in_string = string_from_keyboard ; while ( *character_in_string != 0 ) { character_in_string ++ ; } int string_length = character_in_string - string_from_keyboard ; printf( "\n String length is %d" "\n\n Here is the string in wide form: \n\n ", string_length ) ; character_in_string = string_from_keyboard ; while ( character_in_string < string_from_keyboard + string_length ) { printf( " %c", *character_in_string ) ; character_in_string ++ ; } printf( "\n\n Here is the string in reverse form: \n\n " ) ; while ( character_in_string > string_from_keyboard ) { character_in_string -- ; printf( "%c", *character_in_string ) ; } printf( "\n" ) ; } /* Here is a sample run of this program: This program manipulates a string by using a pointer. Please, type in a string. Linus Torvalds String length is 14 Here is the string in wide form: L i n u s T o r v a l d s Here is the string in reverse form: sdlavroT suniL */