C-the C Answer (2nd Edition)-Exercise 1-17

Source: Internet
Author: User
/* Write a program to print all input lines that is longer than characters. */#include <stdio.h> #define MAXLINE        //Maximum input line size */#define longline 80int getline (char line[] , int maxline);/* print lines longer than longline */main () {int len;                /* Current line length */char line[maxline];     /* Current input line */while (len = getline (line, MAXLINE)) > 0) {if (len > longline) {printf ('%s ', line);}} return 0;} /* Getline:read a line into S, return length */int getline (char s[], int lim) {int C, I, j;j = 0;for (i = 0; (c = GetChar ())! = EOF && c! = ' \ n '; ++i) {if (I < lim-2) {s[j] = C;       /* Line still in boundaries */++j;}} if (c = = ' \ n ') {s[j] = c;++j;++i;} S[J] = ' + '; return i;}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

C-the C Answer (2nd Edition)-Exercise 1-17

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.