BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsBSD Help

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 12th, 2007, 08:17 PM
RDG's Avatar
RDG RDG is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: Cancún. México
Posts: 141 RDG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 6 h 32 m 51 sec
Reputation Power: 3
Question Darwin bus error

Hi, I'm a bit new to unix so please be patient. I wrote a very simple prgram in C that recieves input from the user and performs a simple operation. Here's the code:

Code:
#include <stdio.h>
int main() {
    int a, b, c;
    printf("Enter the first value: ");
    scanf("%d", &a);
    printf("Enter the second value: ");
    scanf("%d", &b);
    c = a + b;
    printf("%d + %d = %d\n", a, b, c);
    return 0;
}


This should work perfectly but whenever I hit enter, after entering both values, I get an error that says "bus error". And sometimes "segmentation fault". What is this? What can I do to make it work?

Thanks

Last edited by RDG : April 12th, 2007 at 08:39 PM.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsOperating SystemsBSD Help > Darwin bus error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway