Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!dimacs.rutgers.edu!seismo!ukma!ghot From: ghot@s.ms.uky.edu (Allan Adler) Newsgroups: comp.lang.c Subject: printf and scanf in IBMC on IBM 3090 Message-ID: <1991Feb4.234251.14836@ms.uky.edu> Date: 4 Feb 91 23:42:51 GMT Sender: ghot@ms.uky.edu (Allan Adler) Organization: University of Kentucky Lines: 27 Perhaps someone can clear up a mystery. The enclosed program compiles correctly using IBMC on an IBM3090. When I run it, it refuses to execute the first printf until after the user has typed something in for the scanf statement, whereupon it executes both printf statements. In order to get the program to work correctly, the line printf("Please type your name: "); has to be replaced by printf("Please type your name: \n"); I would never have predicted this based on my previous experience with C and my readings. Can someone tell me if this behavior is consistent with the ANSI standard ? Allan Adler ghot@ms.uky.edu ========================================================================== #include main() { char name[20]; printf("Please type your name: "); scanf("%s",name); printf("You can do it, %s!\n",name); } Allan