Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
I haven't done C in so long...this VERY simple program doesn't work!?
include <stdio.h>
#include <stdlib.h>
main(void){
printf("\nProgram to catagorize earthquakes.\n");
char str[] = "Try a C-string!";
puts(str);
system("pause");
}
I'm using Code::Blocks, which I'm new at, I usually use Dev C++.
What's wrong with this very simple program? Thanks.
I just tried it in Dev C++ and it works just fine. To answer the other question: there are no error messages, the console window shows up with none of the text that I tried to print. The console window does stay there with the message from the system("pause") statement. So...it's something to do with my lack of familiarity with Code::Blocks., probably.
What's funny is that I decided to start using Code::Blocks instead of Dev C++ because of comments here...also, many posters have said that Borland is obsolete...I'm sure that my problem is in what I'm doing with Code:;Blocks since that code works OK in Dev C++.
4 Answers
- tbshmkrLv 71 decade agoFavorite Answer
State what program is to do!
=
/* Re-Written [again!] for ease of reading.*/
#include <stdio.h>
#include <stdlib.h>
int main( )
{
char str[] = "Try a C-string!";
{
printf("Program to categorize earthquakes.\n");
puts(str);
}
system("pause");
return 0;
}
ADDED: Compiles with no errors.
Program executes no errors.
Outputs TWO lines:
Program to categorize earthquakes.
Try a C-string!
CodeBlocks 10.05
gcc version 4.5.0
- 1 decade ago
try this program I also dont have confirmation
include <stdio.h>
#include <stdlib.h>
main(void)
{
char *str = "Try a C-string!"; //in c declaration comes first, some compiler doesnot support [],
// instead try *str
printf("\nProgram to catagorize earthquakes.\n");
puts(str);
system("pause");
}
- PfoLv 71 decade ago
It would help if you told us what error message you are getting or what isn't working.
My best guess is to try declaring main() as:
int main(int argc, char **argv)
- 1 decade ago
sorry can't help for C ......... i only know is C++ and VB.net. But i just wanna say that only due to these errors BORELAND ROCKS :) lolz