LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-24-2012, 04:18 AM   #1
curious95
Member
 
Registered: Oct 2012
Location: /home/v
Distribution: Slackware 14.0
Posts: 83

Rep: Reputation: Disabled
Post gcc, segmentation fault error


When i try to run the binary of the source code attatched i get this error
Code:
Enter Item number: 12
Enter Unit price: 12
Enter Purchase date (mm/dd/yyyy) : 12/12/1222
Segmentation fault (core dumped)
I get this error no matter what input i give.
Attached Files
File Type: txt 1.txt (471 Bytes, 26 views)
 
Old 11-24-2012, 04:32 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
forgotten & signs in scanf
 
1 members found this post helpful.
Old 11-24-2012, 04:33 AM   #3
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 852

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Your forgetting to reference the variables in scanf. Also, if you want input (or output) with slashes, your FORMAT string should reflect that:

Code:
scanf("%d/%d/%d", &month, &day, &year);
 
1 members found this post helpful.
Old 11-24-2012, 04:41 AM   #4
curious95
Member
 
Registered: Oct 2012
Location: /home/v
Distribution: Slackware 14.0
Posts: 83

Original Poster
Rep: Reputation: Disabled
I can't believe i forgot that thanks
 
  


Reply

Tags
segmentation fault


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc throws Segmentation fault runtime error mrajdeep Programming 9 08-22-2011 02:30 PM
[SOLVED] SEGMENTATION FAULT using gcc 4.4.4 -O2 , works with gcc 4.1.0 -O2 or gcc 4.4.4 -O1 amir1981 Programming 36 07-26-2010 06:07 PM
Weird problem, can't compile kernel: gcc: Internal error:Segmentation fault (prgm as) abefroman Linux - Software 4 08-01-2006 05:28 PM
[gcc] internal error: segmentation fault fskmh Slackware 3 01-22-2003 05:36 PM
gcc / segmentation fault skeletal29 Linux - Software 0 05-05-2002 04:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration