Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Newsgroups | comp.lang.c |
|---|---|
| Date | 2015-11-18 09:03 -0800 |
| References | <8a605c3e-2e2d-456f-bcf4-f23bf4c40bc2@googlegroups.com> <lna8qbgsmr.fsf@kst-u.example.com> |
| Message-ID | <f5f4bf50-1229-4061-ac68-e15facd034b7@googlegroups.com> (permalink) |
| Subject | Re: Program to print the longest line |
| From | Alla _ <modelling.data@gmail.com> |
On Wednesday, November 18, 2015 at 8:49:24 PM UTC+4, Keith Thompson wrote:
> Alla _ <modelling.data@gmail.com> writes:
> [...]
> > #include <stdio.h>
> >
> > #define MAXLINE 1000 /* maximum input line size */
> >
> > int getline (char s[], int lim);
> >
> > // this is how this line looked before I changed it:
> > int getline{char line[], int maxline);
> >
> > I changed it because the prototype differs from the
> > function declaration //
>
> Parameter names are not required to match. In a function declaration
> (prototype) that's not part of a definition, parameter names are
> ignored. On the other hand, making the names consistent is good style.
>
> Incidentally, you might have some problems with your "getline" function,
> since there are third-party functions with the same name. I think POSIX
> defines a "getline" function. If you're careful to compile in
> conforming mode, it shouldn't be an issue, but you might want to
> consider changing the name to avoid confusion. "get_line" should be ok.
>
Yes, thank you. I have figured that out only after I posted this
message, and have changed the name of the function to precisely get_line()
a bit later.
> [...]
> And yes, what's passed to the function is not the array, but the address
> of its first element (and no information about the array's size unless
> you pass it explicitly -- which you do). This is described in section 6
> of the comp.lang.c FAQ, <http://www.c-faq.com/>, but you seem to have a
> good handle on it.
>
Thank you. To my shame, I have not yet visited the FAQ part.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 08:10 -0800
Re: Program to print the longest line Keith Thompson <kst-u@mib.org> - 2015-11-18 08:49 -0800
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 09:03 -0800
Re: Program to print the longest line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-18 09:04 -0800
Re: Program to print the longest line Keith Thompson <kst-u@mib.org> - 2015-11-18 09:24 -0800
Re: Program to print the longest line Richard Heathfield <rjh@cpax.org.uk> - 2015-11-18 17:42 +0000
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 10:49 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-18 13:55 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 11:01 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-18 14:19 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 21:50 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-19 06:39 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-19 05:07 -0800
Re: Program to print the longest line James Kuyper <jameskuyper@verizon.net> - 2015-11-19 10:12 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-19 07:49 -0800
Re: Program to print the longest line Richard Heathfield <rjh@cpax.org.uk> - 2015-11-18 19:08 +0000
Re: Program to print the longest line Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-18 14:54 -0500
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 23:36 -0800
Re: Program to print the longest line Keith Thompson <kst-u@mib.org> - 2015-11-19 21:15 -0800
Re: Program to print the longest line Geoff <geoff@invalid.invalid> - 2015-11-19 21:29 -0800
Re: Program to print the longest line David Brown <david.brown@hesbynett.no> - 2015-11-20 11:00 +0100
Re: Program to print the longest line glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-20 15:13 +0000
Re: Program to print the longest line supercat@casperkitty.com - 2015-11-20 11:29 -0800
Re: Program to print the longest line Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-20 12:51 -0800
Re: Program to print the longest line Philip Lantz <prl@canterey.us> - 2015-11-24 01:59 -0800
Re: Program to print the longest line Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-27 13:34 -0800
Re: Program to print the longest line John Gordon <gordon@panix.com> - 2015-11-18 18:10 +0000
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 10:53 -0800
Re: Program to print the longest line Barry Schwarz <schwarzb@dqel.com> - 2015-11-18 13:55 -0800
Re: Program to print the longest line Alla _ <modelling.data@gmail.com> - 2015-11-18 23:32 -0800
Re: Program to print the longest line Barry Schwarz <schwarzb@dqel.com> - 2015-11-18 11:58 -0800
csiph-web