Compile And Run Your Code Online Using CodePad

Have you ever been in a situation where you want to desperately try out a piece of code to see what will be the output of it; but are running here and there just to get a machine which has an installed compiler/environment for the same. This could happen when eg you are not in office and just have a eureka about your code OR suddenly want to try out some small change.

How about a web service where you could type, compile and run your code and see what output will it give and that too in your web browser? If this sounds interesting -- than CodePad is one option that you should definitely have a look at. It has a very simple/clean interface and supports all the major languages like C, C++, Python, PHP, Perl etc( Refer he snapshot below for the complete list )

Codepad Interface

What is CodePad?

  • You can view it as an online compiler and executor of code.
  • You type ( or copy paste ) a piece of code and CodePad runs it for you displaying the output.
  • It helps you to collaborate by providing you a URL that can be shared with friends to showcase/discuss any new coding ideas.
  • Find more information on how it works and which exact compiler versions are used for each language on CodePad about page.
  • This all comes absolutely free with no registration/email required.

So lets see how this works. To begin with lets create a couple of sample programs in C and PHP and checkout how it works

C Code Snippet

Step 1

This is a simple program that will just print a message in the output


#include "stdio.h"
int main(void)
{
 printf("\\n This is a C Code Snippet") ;
 return 0 ;
}

Step 2

Lets copy paste the above code snippet in to CodePad and click on Submit button. The output is as given below -- our print can be seen in the output.

Codepad C Output

Step 3

Now lets remove a semicolon after the printf to create a compilation error and see what happens

#include "stdio.h"
int main(void)
{
printf("\n This is a C Code Snippet")
return 0 ;
}

Step 4

Copy paste the code and on clicking the submit button, the output is as given below where the compilation error can be seen.

PHP Code Snippet

Lets try with a PHP Code Snippet and check out whether it works

<?php
echo “This is a php test”
?>

Following is the output, showing the print which we put.

Codepad PHP output

Note -- By default, any pastes on CodePad are public and get shown on “Recent Pastes”  as well as get  indexed by search engines. If you want to avoid this, you can click on the checkbox title private to the left of the submit button( Refer below )

Codepad Private Button

If you use Vim regularly,  you can also download the vim plugin which can paste/run your vim buffer to CodePad.

We really found the service extremely useful and strongly recommend it for use in situations where you don’t have any terminal access to compile/run your code snippet. In such situations,  just go to CodePad and let it do the job for you in a matter of few clicks!!

Do try CodePad and share your thoughts on the same with us in the comments section.





Inficone runs on the Genesis Framework

Genesis Framework
Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!
Follow On Twitter
Follow On Facebook
Follow Using RSS
Follow Using Email
Tweet This Post
Share Post On Facebook
Digg This Post
Stumble Upon

Comments

  1. http://onlinegdb.com is also good online IDE with compiler and command line gdb debugger for C/C++.

  2. try Ideone.com – it’s better in my opinion!

  3. try http://ideone.com – it’s better in my opinion!

Speak Your Mind

*

This blog is kept spam free by WP-SpamFree.