View previous topic :: View next topic |
Author |
Message |
rafaluc
Joined: 12 Apr 2006 Posts: 6
|
RS232 |
Posted: Mon Jan 03, 2011 5:51 am |
|
|
Which the difference between putc and putchar. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Mon Jan 03, 2011 8:05 am |
|
|
There is no functional difference, only aesthetic. I think if you look in the header files you will find putc is defined as putchar. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Mon Jan 03, 2011 9:29 am |
|
|
It is 'historical'.
putchar, is originally defined in K&R, as being equivalent to putc(c, stdout).
putc, in the original C implementation was equivalent to fputc, and required a stream name. On the standard C implementation, you always had three streams defined. stdin, stdout, and stderr (error output). If you just wanted to talk to stdout, and didn't want to type the name, you just use putchar.
In CCS, they are identical.
Best Wishes |
|
|
|