Hello and welcome back.
In this lecture, I'm going to actually provide you with another option of how you can write and compile
your C programs, mainly using an online C editor compiler.
This is useful if you if you don't have your computer, or if you're in an environment where you only
have access to a web browser and you want to write some code, you don't have your own computer set
up with your IDE, or you don't have access to a command line interface.
You just have a browser.
And there's many online C compilers that are online in a browser.
So I'm just going to bring up my Chrome web browser and show you a couple that are available.
There are a lot of different ones out there.
You can essentially Google just online C compiler to find out many of the ones that are out there.
I'm just going to show you a few.
Again, the whole idea is that on a server somewhere, there's a way to edit and compile and run your
C code just online through a browser.
One of the more popular ones, one of the first ones you'll see is this one here, which is the online
gdb beta.
If you look right here on the link is w-w-w dot online gdb.com/online_c_compiler.
Again, if you do a Google search for online C compiler, usually this is the first one that comes up.
You can select that link.
It's pretty basic interface.
Again you have run and debug.
You can actually debug stop share.
It actually comes up with a code template initially with the main and the print.
Hello world.
You can also pass command line arguments in to your program, so it has some nice features here.
The interactive console can allow you to actually ask the user for input as well, and it will come
down here.
But the basic program, all you need to do is you can write and code and edit it here in this editor.
And then when you're ready to use it, you can just say run.
And this will actually compile the program down below will tell you if you have any errors.
And then it will do the output.
So if you had an error here and it automatically saves for you as well and you hit run, you'll see
the errors listed below as well.
So it's a nice little, little online compiler that you can use if you don't like the idea.
If you don't have access to the IDE.
Again, interactive and allows you to pass command line arguments and again it allows you to run the
debugger.
We'll talk about the debugger in much later sessions, but this is just an introduction to some online
compilers, so you can check that one out.
Another one that's commonly used, although sometimes it has some performance issues is the tutorials
point online C compiler.
This one you can grab through the coding ground online C compiler.
So if you just go to tutorials point.com/compile_c_online.php.
Again a similar interface here, except now you have the editor on the left hand side and then the terminal,
the output on the right hand side.
So you can write your code, you can select execute and you'll see the output on the right hand side.
Now this one doesn't have a debugger.
This is a little bit more limited, but it will show you errors.
If you have errors you know things like that.
And it allows you to run basic C programs.
You can also get input from the terminal by if you do, if you want to get input you would enter the
input over here.
Pretty nice interface, pretty tedious sometimes.
I've seen this one have some performance problems.
You know, with all the online C compilers you're always going to have a limited number of features.
You know, I don't actually know how long this C source code is saved or cached in your browser, so
you may want to copy it.
If you do write a program, copy it and save it somewhere else because online I'm not sure.
Another one that's used is I think it was the second link here at the current time of this video.
Is this one by program, is this one is C online compiler at program is.com/c-programming/online-compiler
again more of the same write source code here.
Output on the right.
You run it, you see the output and so forth.
Not sure if this was an interactive last one I want to show you really quickly is a Cs50 IDE compiler.
And so if you go to the online C compiler, you type in Cs50 IDE.
I've used this for, for different things mainly.
The nice thing is it has a Linux terminal terminal.
So if you type in Cs50 IDE in Google you'll see this come up with the link.
Now initially when you go to the Cs50 IDE, at least at the time of this recording, which is ide cs50.io,
you'll see that the old way of doing things is deprecated.
So you want to click this link code Cs50 IO you want to go to code spaces.
The only prerequisite for using this online IDE is.
Is that you have a GitHub account, so you actually have to sign up for GitHub.
Have a username and password.
But once you select that link and once you're logged in to GitHub, it will take you to this Visual
Studio Code for Cs50.
And you can just say log in because you'll have to log in to GitHub if you're not already logged in.
Once you log in, it will ask you to authorize Cs50 IDE to just do some things.
If you're comfortable with this, you can say authorize Cs50, IDE, and then you'll be redirected to
the authorized application.
It may take a few minutes to build and set up your codespace initially.
And so once everything is loaded, what you'll end up seeing is this type of interface.
And it looks like an IDE, right.
So this is why this one's a little more, more robust.
So you can go up here and you can make sure you select new file not new folder new file.
And you can name it hello World dot C.
And you'll see that file being created.
And then the editor is on the right.
So then you can actually start writing some source code for a standard C file.
And then in order to run that code, you just hit the run and you'll see errors and so forth.
Down in here you can also interact with the Linux terminal by issuing commands.
Here you can see Hello World dot C was actually created here.
So if I just take a copy and paste and take some code and it has line numbers, which is nice, you
can run it and run in debug.
And it kind of has this Visual Studio interface.
So if you don't want to actually run it over there, you can run it in the terminal through the command
line interface like I showed you before.
This is running in debug, you know, but it's a nice, nice little interface here.
I usually just go to the terminal and I'll actually just type in commands to execute.
But this is another option to run and write your code.
Now just remember that with all of these online C compilers, as they are somewhat limited on features,
they use the GCC compiler or variation of it, but they may not support all the features in the class.
So if you're doing advanced C programming and you're doing things like sockets and you're doing things
like threads, these online C compilers typically won't work for that.
But they are a nice third option.
If you're on the run and you want to write some C code, you don't have your laptop and you don't have
an IDE and you don't have any kind of terminal in play, you don't have Cygwin installed or whatever.
These online C compilers are a nice alternative.
Thank you.