I have found to Embed C code in blogger/blogspot to be very easy using GitHub's gist.
https://gist.github.com/ is very similar to Pastebin, but using GitHub has its own advantages. A file that you want to share is a "gist". If you are a git user, you can use the git's fork and other revision control on the gist file. All you need is a github account.
Integrating code in blog:
a. Visit gist.github.com
b. (Optional) Choose a filename and set file type for better syntax highlighting
c. Write/copy your code
d. Create a public gist - you need to share the code in your blog to the world!
Once you are done creating the gist, it gives you "embed link" on the right pane. Just copy the link and paste it in the HTML of your blog. You will have a bright, dazzling, syntax highlighted code in your blog.
A sample created from Gist:
Pros:
a. Easy to create
b. "View Raw" feature - it lets users to neatly copy the code and try on their systems.
Cons:
a. Maintain a lot of gist files is difficult. It would be great if github allows embedding a file from GitHub repository instead from gist. Do let me know in the comment section if such a thing is already there!
<<< Sharing is caring >>>
https://gist.github.com/ is very similar to Pastebin, but using GitHub has its own advantages. A file that you want to share is a "gist". If you are a git user, you can use the git's fork and other revision control on the gist file. All you need is a github account.
Integrating code in blog:
a. Visit gist.github.com
b. (Optional) Choose a filename and set file type for better syntax highlighting
c. Write/copy your code
d. Create a public gist - you need to share the code in your blog to the world!
Once you are done creating the gist, it gives you "embed link" on the right pane. Just copy the link and paste it in the HTML of your blog. You will have a bright, dazzling, syntax highlighted code in your blog.
A sample created from Gist:
Pros:
a. Easy to create
b. "View Raw" feature - it lets users to neatly copy the code and try on their systems.
Cons:
a. Maintain a lot of gist files is difficult. It would be great if github allows embedding a file from GitHub repository instead from gist. Do let me know in the comment section if such a thing is already there!
<<< Sharing is caring >>>