Mac Gcc Bus Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Bus Error 10 C++
of this site About Us Learn more about Stack Overflow the company bus error 10 mac Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges bus error: 10 node Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute:
Bus Error 10 Gulp
Sign up Bus error troubleshooting up vote 7 down vote favorite 3 I am trying reverse a string. This is the code I tried: #include
Bus Error Linux
} printf("\n reversed string is : %s\n\n",c); } The code outputs a Bus error : 10. But if I rewrite the same code as: int main(void) { char *str; str="I am a good boy"; int i,j; char temp; int len=strlen(str); char *ptr=NULL; ptr=malloc(sizeof(char)*(len)); ptr=strcpy(ptr,str); for (i=0, j=len-1; i<=j; i++, j--) { temp=ptr[i]; ptr[i]=ptr[j]; ptr[j]=temp; } printf("The reverse of the string is : %s\n",ptr); } It works perfectly fine. Why is the first code throwing bus error or segmentation fault? c string string-literals share|improve this question edited Sep 18 '11 at 1:11 Jeff Mercado 68.5k12128164 asked Sep 18 '11 at 1:03 sethu 60631227 1 please reformat your code. –Daniel A. White Sep 18 '11 at 1:04 I tried formatting as much as possible, but i really dont know how to have them aligned. –sethu Sep 18 '11 at 1:07 1 Please format your code by indenting it all with four spaces. –SLaks Sep 18 '11 at 1:08 1 In the future, highlight all your code, then click the {} icon. –Matthew Flaschen Sep 18 '11 at 1:14 1 @sethu
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the bus error (core dumped) linux company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Bus Error Core Dumped C
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million how to debug bus error programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Bus error: Inline x86 assembly with GCC on Mac OS X up vote 4 down vote favorite I am getting a http://stackoverflow.com/questions/7458854/bus-error-troubleshooting "Bus error" when I try to run this code compiled with gcc 4.2.1 on Snow Leopard #include
10 iPad Air 2 iPad mini 4 (2015) iPad Pro iPhone 6s iPhone 7 iPhone 8 (2017) iPhone SE iPod nano iPod shuffle iPod touch Mac mini Mac Pro MacBook Air MacBook Pro macOS Sierra Retina MacBook Thunderbolt Display tvOS 10 watchOS 3 Buyer's Guide Forums Forums Front Page Roundups Buyer's Guide Forums Roundups OS X Yosemite MacBook Air iOS 8 Apple Watch Log in Sign up Recent Posts Spy Support Support Quick Links General FAQ MacRumors Theme FAQ Contact Us Lost Password Menu Search titles only Posted by Member: Separate names with a comma. Newer Than: Search this thread only Search this forum only Display results as threads More... Useful Searches Recent Posts Options Please select a forum to jump to News and Article Discussion MacRumors.com News Discussion Mac Blog Discussion iOS Blog Discussion iPhone, iPad, and iPod Touch iOS iOS 9 (Beta) iOS 8 iOS 7 Older iOS Versions iOS 6 iOS 5 and earlier iPhone iPhone iPhone Tips, Help and Troubleshooting iPhone Accessories iPhone Launch Meetups iPad iPad iPad Tips, Help and Troubleshooting iPad Accessories iOS Apps iPod touch iOS Programming iPod Jailbreaks and iOS Hacks Alternatives to iOS and iOS Devices Apple Watch Apple Watch Apple Watch Accessories Apple Watch Apps Macs OS X OS X OS X El Capitan (10.11, Beta) OS X Yosemite (10.10) OS X Mavericks (10.9) Older OS X Versions OS X Mountain Lion (10.8) Mac OS X Lion (10.7) Desktops iMac Mac Pro Mac mini Notebooks MacBook MacBook Pro MacBook Air Mac Basics and Help Mac Programming Buying Tips and Advice PowerPC Macs Mac A