ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I thought that maybe I might perhaps possibly learn to learn C.
I had that same idea almost 20 years ago when I still used Windows 98, and I had a good shell that would run C lines/commands etc. I could also run little C programs in "script" mode, as an interpreter rather than a compiler. It was very convenient. Obviously, I can't remember its name.
There has to be something like that for Linux, right?
Let's see.
So I found SoftIntegration's Ch but it's not free and I am broke.
Picoc sounds interesting, but it's not available in the Debian repository and the source won't build on my machine.
Cint sounds interesting, but it's not available in the Debian repository and the source won't build on my machine.
Ups sounds interesting, but it's not available in the Debian repository and the source won't build on my machine.
I'm pretty sure there was another one that I can't remember and it seems I have deleted it, but anyway, it wouldn't build either.
Can you nice people perhaps recommend me something in that general direction?
I thought that maybe I might perhaps possibly learn to learn C.
I had that same idea almost 20 years ago when I still used Windows 98, and I had a good shell that would run C lines/commands etc. I could also run little C programs in "script" mode, as an interpreter rather than a compiler. It was very convenient. Obviously, I can't remember its name.
There has to be something like that for Linux, right?
Let's see.
So I found SoftIntegration's Ch but it's not free and I am broke.
Picoc sounds interesting, but it's not available in the Debian repository and the source won't build on my machine.
Cint sounds interesting, but it's not available in the Debian repository and the source won't build on my machine.
Ups sounds interesting, but it's not available in the Debian repository and the source won't build on my machine.
I'm pretty sure there was another one that I can't remember and it seems I have deleted it, but anyway, it wouldn't build either.
Can you nice people perhaps recommend me something in that general direction?
TIA
C is a compiled language, end of story. It cannot be run in any interpreted or script form.
Why do you feel the type of shell matters?
Whichever shell you have should be fine. Ensure you have the build-essential package to be able to compile C code.
All that matters are the terminal properties of the console, and any helping paths to compile and debug tools
The shell is not as relevant as the C programs you write.
I was surprised to see that there are quite a few "interpreters" for C.
My first thought was that they might implement/emulate some of the language and some of the standard library features, but that it would be very difficult to implement C as an interpreted language, at least in a useful way.
That seems to be the case because the few that I looked at just now (admittedly a quick glance) all began with a disclaimer of sorts, this from Picoc: "It's not intended to be a complete implementation of ISO C but it has all the essentials."
But I have to ask another question, not being argumentative, but seriously: Why not just learn C in its common form, as it exists on your Linux system? What advantage do you expect to get from an interpreted C? Consider also that perhaps it was the intepreter that actually kept you from learning C 20 years ago!
Whatever the case, best of luck with you learning experience!
Last edited by astrogeek; 09-05-2022 at 04:38 PM.
Reason: expando-comments
Understanding thar there's a term REPL was not in my experience.
A website or tool you can install which will allow you to run C code in the manner of a script is beneficial to learn and also helpful to use in interviews, where I have used online collaboration tools to evaluate candidates.
This seems to have been the OP's intended question, to find recommendations for something like a C REPL.
Unfortunately I have no specific recommendations if this is their need.
My 2 cents. If you have a text editor, a terminal, and whatever development tools that your distro has The GNU Compiler Collection in, you have what you need to start learning C/C++.
gcc -Wall is very good at flagging potential problems. I can't think of anything that an interpreter can do that gdb can't. You may be surprised by how good these tools have become.
Ed
You want a C REPL. Google for that.
I'd do it for you, but you can do it as well as I can.
I had come across that term in my own research already, when I found out about those tools I mentioned that I could not build. Being aware of that term does not help much. I found something, but I am dissatisfied with what I found.
What someone here (obviously not you) could do for me is to point out some tool like the one I am looking for that was helpful to them in their own experience. Something along the lines of, "Hey, yeah, I needed that at some point of my life and tried this and that tool, and I thought that XC is better because YC is too ______ or not _____ enough, especially considering that ______ ______ ______." It doesn't seem to me that you have any such experience. Or maybe you do, but somehow you think it's more appropriate to tell me to go ask my annoying question elsewhere (more specifically, a website that obtains a huge portion of its answers from forums like this one which puts us in an opposite mirrors kind of recursive situation, but I digress). Hopefully, someone else will show up with the right kind of experience.
Quote:
Originally Posted by rtmistler
A website or tool you can install which will allow you to run C code in the manner of a script is beneficial to learn and also helpful to use in interviews, where I have used online collaboration tools to evaluate candidates.
This seems to have been the OP's intended question, to find recommendations for something like a C REPL.
I don't know how the tool I am looking for would be useful in interviews, but "beneficial to learn," YES. That is absolutely it. You get it.
By the way...
Quote:
Originally Posted by astrogeek
But I have to ask another question, not being argumentative, but seriously: Why not just learn C in its common form, as it exists on your Linux system? What advantage do you expect to get from an interpreted C? Consider also that perhaps it was the intepreter that actually kept you from learning C 20 years ago!
That is in fact a very good question.
I've been self taught on many occasions, many situations, and I know I am a very good learner. For example, I taught myself English for the most part, in a time when there was no Internet as we know it. I can get across well, don't you think? But I have my own way of learning. Two things I really like: lots of involvement and visual input. And no hurry. That's how I learn best. So I want to be able to test and try a lot of small things and see what happens until those mechanisms become very predictable, like some kind of second nature. It's also good and necessary to do that in very quick and brief sessions. I will not put up with the concept of reading a lot of information at once and writing up long programs and compiling, and reading the error output, and rewriting, and recompiling, and reading the error output, and rewriting, and recompiling, and reading the error output, and rewriting, and recompiling, and again and again and again... Quick and casual shots of coding and watching the result will whet my appetite to learn more - no hurry. I will eventually embrace more traditional approaches when I feel that I am ready for them. Not before. Before wouldn't work. That would make me lose my patience and quit. Maybe it works for you and a lot of people, but I am neither you nor a lot of people. I've taught myself many times before and I know how my brain works. I will work in harmony with it, not in conflict. I will not "tough it up" or subject myself to silly notions of "tough love." That wasn't always such a bad idea when I was young, but now I am a lot older, more tired and with a lot less time, including brain CPU time. I will do the smart thing and learn it the way it works for me.
Quote:
Originally Posted by astrogeek
Consider also that perhaps it was the intepreter that actually kept you from learning C 20 years ago!
It was definitely not. In fact, the interpreter is the sweetest memory I have of that very short lived personal project. I can't remember for sure, but I believe I probably just decided to go with scripting because it was easier, more convenient, more practical.
Quote:
Originally Posted by teckk
As far as running C code in a shell with an interpreter, sounds like you want python.
I loathe Python. Always have. I would gladly push a button and make Python disappear from the face of the Earth right now if I had the chance, without a hair of care about all the crying and grinding of teeth it would cause. But thank you for the links. I will certainly read them and see what I can learn from them. I am hunching over this right now:
Thanks. I will read that too. It's not what I asked, it's just more documentation and there is plenty of that on the internets already, I want an interactive tool that will make learning more digestible to me, but yes, I will read it.
First search result. Enjoy your exploration. And I personally find that one to be fine, it works.
No one's intentionally trying to be rude, there are many results when you search for "c repl" and people figure you would prefer to select from a possible variety of options.
Is there any error message when some software "won't compile"?
Edit: I've found an old source for cint (http://www.hanno.jp/gotom/cint.tar.gz), but it is in C++, so it won't compile, indeed.
I think the OP's problem may be that setting up a developer environment on Debian is non-trivial, especially for building programs not in the repository. He would have an easier time on a distro that is a developer environment by default (i.e. Slackware).
Ed
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.