r/learnprogramming • • 1d 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

18 Upvotes

35 comments sorted by

View all comments

5

u/serge-mv 1d ago

Both of those are popular and good IDEs. If you are having trouble with them, then you probably should try and figure out why things aren't working as expected. Changing an IDE won't really help you here. Dealing with problems like these is part of the job.

1

u/Roughneck979 1d ago

Well i typed the example code in codeblock and hit the build and it did nothing, tried run and it said it wasnt built yet, clicked yes and still just sat there and nothing happened, maybe installed wrong?

2

u/serge-mv 1d 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.

1

u/Roughneck979 1d ago

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

1

u/serge-mv 1d 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.