简体   繁体   中英

Where can i find the definition of functions declared in c standard header files like stdlib.h?

I am using Linux (ubuntu).

I want to read the function definitions of some functions which are declared in header files like stdlib.h

I tried looking for stdlib.c but could not find one.

Can anyone please let me know where can i find the corresponding code file on my system.

Forgive me if i am being too naive. Thanks

You need to download the source code for glibc . Your distribution will typically only ship with a compiled version of the C library. See also the Wikipedia article .

(Eg on Debian-like systems try apt-get source libc6 .)

glibc isn't the only C library for Linux-like systems, there exist a couple of "competitors". For example, uClib is a very small alternative intended for embedded applications.

For most Linux-based systems, the standard library is provided by glibc. You can browse the git repository here:

http://sourceware.org/git/?p=glibc.git;a=tree

Note that much of the interesting source is tucked away under the sysdeps tree, particularly sysdeps/unix/sysv/linux and similar.

As the foregoing answers explain, the code for the functions on Linux is included in glibc . If you need the exact code running on your system, that is our only recurse. If you are just interested in how the functions can be implemented, perhaps the best bet is to look at simpler libcs, look at uClibc , the micro libc for embedded use; look for the libc sources for Minix (the original, not the current Minix3); perhaps the one in Plan 9 is also suitable.

If you used in ubuntu means you run the Cprogram using vim editor.so which header file you want that header file you press the gf in Esc mode. example

      #include<stdio.h>
     you placed in the cursor point s and press the gf then automatically  go to the standard library of stdio.h

                (or)

Change the directory using command

                  cd /usr/include

This directory is contains in all header files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM