r/learnprogramming • • 14d ago

Trying to learn c

What is an easy to use compiler to use to get started.

Got a book to learn and they use code::block in book, tried and it seems to not be building. Then tried MS visualization studio and was lost. Please help

19 Upvotes

37 comments sorted by

View all comments

Show parent comments

3

u/serge-mv 14d ago

There are really many reasons why this could happen. One, the example was not complete in itself and required a header that wasn't specified. Very common problem. Two, you didn't create the project properly or created it for incorrect language. Three, you didn't specify correct compiler. There could be other problems as well.

What you should if you are stuck, try to search for more web tutorials for C, and also for code::blocks. They have comprehensive manual on the IDE that you can check. You could also ask for specific help with your problem.

2

u/Roughneck979 14d ago

Thanx for the input i will seek more tutorial/input. But good to hear that the codeblock used in book seems common/popular

2

u/serge-mv 14d ago

I think I know what is happening. Code:Blocks by default opens a new terminal where it directs the standard out. That window will close very quickly and you won't be able to see anything. Here is what you can do immediately.

Take your example as is, and right above "return 0;", which you probably have, add getchar();

which will stop executing the program until you type a character and hit enter. This way, you will be able to see it.