I remember viewing source code of library function but now I don't know how to view it. How to view the source code of library function?

2 Answers 2


Try /usr/include/. If you're not able to find it there, try:

find /usr/include/ -name string.h

*.h files are header files and usually holds limited functionality. To view the source for functions you need to download the/a C-library. On Ubuntu you can do e.g.:

apt-get source libc6

Then enter the newly created directory and play around.

To make the browsing more pleasant use an indexing program like cscope. Doubt gedit has any integrated support for it, but other tools such as (G)vim gives you the opportunity to connect to the cscope database internally.

As such, you can press a sequence of keys to jump to declaration of functions etc.

On the web this can be of help if you are interested in glibc.

You might also find answers here helpful.

  • Do you know any way to view source of library function using codeblocks?
    – Habi
    Commented Nov 10, 2013 at 15:34
  • @Habi: Not tested it. But they have this plugin for cscope.
    – Runium
    Commented Nov 10, 2013 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .