hw7p2.c - \/Kyle Yamamoto\/This program takes a user sentence and reverses the order of words#define_CRT_SECURE_NO_WARNINGS#include<stdio.h> int main(void

hw7p2.c - /Kyle Yamamoto/This program takes a user...

  • Homework Help
  • captain0cat
  • 1
  • 100% (2) 2 out of 2 people found this document helpful

This preview shows page 1 out of 1 page.

//Kyle Yamamoto //10-28-2014 //This program takes a user sentence and reverses the order of words #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main(void) { char sentence[100], space = "a", word[20] = ""; //Initializing and defining variables int length = 0, counter = 0, i = 1, j = 0, total = 0; printf("Enter a statement: "); fgets(sentence, 100, stdin); //Reading user input while (space != '\n') { //While loop to find length or the string space = sentence[i]; length++; i++; } while (length > 0) { //While loop for every word in string i = 1; //Defines variables for every loop j = 0; space = "a";
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture