Stdio.h and cs50.h

Hi. i have question
i’m a newbe, and just started with C and watching all the cs50 videos, well just three of them for now :))
From what i understand “stdio.h” and cs50.h are both libraries, compilers. and “stdio.h” is standard on all the computers and servers and so on, basically its pre-installed. but what about cs50.h i mean right now its working while im learning like “get_string” “get_int” on cs50 sandbox, but what about in the future?? from what i understand it wont work, am i right to assume that

thank you!!

In C, you have header files, denoted with the suffix .h. Some of these are ‘built in’ and every C compiler knows how to use them. Others are packaged with libraries you install. Some are local headers you write yourself.

Overall, the purpose of a header is to let the code you have written use functions, variables, structures, ect (though mostly functions early on) that were written by someone else (or yourself!) in some other file or library.

stdio.h is the Standard I/O header that every C compiler needs to support. This lets you use the printf function, for example. There are a bunch of C compilers out there, like GCC, Clang, LLVM, Intel, etc, and they all know what stdio.h includes.

It sounds like cs50.h is a library header. Specifically, cs50.h is part of some software that was written by the team at Harvard to include some things you need for that class. This lets you use the get_string or get_int functions that the Harvard team wrote.

Local headers are files that you write for your programs to let other parts of your program know about each other.

Welcome to learning C! I think it’s a great language to start with!

1 Like