scanf

Bug #1451083 reported by userDepth
2
Affects Status Importance Assigned to Milestone
gcc-defaults (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I compile this code : http://ideone.com/W5Nvfi

I don't get the first full for loop to run, it jumps directly to the rest of the program.

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: gcc 4:4.9.2-2ubuntu2
ProcVersionSignature: Ubuntu 3.19.0-15.15-generic 3.19.3
Uname: Linux 3.19.0-15-generic x86_64
ApportVersion: 2.17.2-0ubuntu1
Architecture: amd64
CurrentDesktop: GNOME
Date: Sat May 2 16:04:20 2015
InstallationDate: Installed on 2015-04-24 (8 days ago)
InstallationMedia: Ubuntu-GNOME 14.10 "Utopic Unicorn" - Release amd64 (20141022.1)
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to vivid on 2015-04-24 (8 days ago)

Revision history for this message
userDepth (binarydepth) wrote :
Revision history for this message
userDepth (binarydepth) wrote :

I'm still having this bug. Scanf doesn't work properly. It keeps prompting for input an extra time in a for loop

Revision history for this message
userDepth (binarydepth) wrote :

Here's another code to test on

http://ideone.com/32aOQM

Revision history for this message
userDepth (binarydepth) wrote :

Maybe is the For loop failing

Revision history for this message
userDepth (binarydepth) wrote :

The problem was on what I was taught in how to use scanf. My professor instructed that we use a newline character (\n) in the format and GCC doesn't work like that anymore. a Simple scanf('%d", &var); does the trick

Matthias Klose (doko)
Changed in gcc-defaults (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.