Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
K&R2 section 1.5.1 - "getchar" problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="arnuld, post: 2746076"] i have slightly modified the programme from section 1.5.1 which takes the input frm keyboard and then prints that to the terminal. it just does not run and i am unable to understand the error message. may you tell me what is wrong and how to make that right ? ------------------------------ INPUT --------------------- #include <stdio.h> int main() { int c; while((c = getchar()) != EOF) { printf("your input: "); putchar(c); printf("\n"); } return 0; } --------------------- OUTPUT ----------------------------- [arch@voodo kr2]$ gcc -ansi -pedantic -Wall -Wextra 151.c 151.c:1: error: expected identifier or '(' before '/' token 151.c:2:12: error: too many decimal points in number In file included from /usr/include/_G_config.h:44, from /usr/include/libio.h:32, from /usr/include/stdio.h:72, from 151.c:4: /usr/include/gconv.h:72: error: expected declaration specifiers or '...' before 'size_t' /usr/include/gconv.h:88: error: expected declaration specifiers or '...' before 'size_t' /usr/include/gconv.h:97: error: expected declaration specifiers or '...' before 'size_t' /usr/include/gconv.h:174: error: expected specifier-qualifier-list before 'size_t' In file included from /usr/include/stdio.h:72, from 151.c:4: /usr/include/libio.h:328: error: expected specifier-qualifier-list before 'size_t' /usr/include/libio.h:360: error: expected declaration specifiers or '...' before 'size_t' /usr/include/libio.h:369: error: expected declaration specifiers or '...' before 'size_t' /usr/include/libio.h:485: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_IO_sgetn' In file included from 151.c:4: /usr/include/stdio.h:306: error: expected declaration specifiers or '...' before 'size_t' /usr/include/stdio.h:608: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fread' /usr/include/stdio.h:614: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fwrite' [arch@voodo kr2]$ [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
K&R2 section 1.5.1 - "getchar" problem
Top