• Stars
    star
    1,382
  • Rank 34,014 (Top 0.7 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created over 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This is CS50's Library for C.

CS50 Library for C

Build Status

Development

make: builds dynamic library

make deb: builds source deb

make install: installs the library under /usr/local by default (set DESTDIR to change that)

Installation

Ubuntu

$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | sudo bash
$ sudo apt-get install libcs50

Fedora

$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.rpm.sh | sudo bash
$ yum install libcs50

From Source (Linux and Mac)

  1. Download the latest release from https://github.com/cs50/libcs50/releases
  2. Extract libcs50-*.*
  3. cd libcs50-*
  4. sudo make install

By default, we install to /usr/local. If you'd like to change the installation location, run sudo DESTDIR=/path/to/install make install as desired.

Troubleshooting

  1. If, when compiling a program, you see /usr/bin/ld: cannot find -lcs50: Add export LIBRARY_PATH=/usr/local/lib to your .bashrc.
  2. If, when compiling a program, you see fatal error: 'cs50.h' file not found: Add export C_INCLUDE_PATH=/usr/local/include to your .bashrc.
  3. If, when executing a program, you see error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory: Add export LD_LIBRARY_PATH=/usr/local/lib to your .bashrc.

Close and reopen any terminal windows.

Usage

Link with -lcs50.

#include <cs50.h>

...
char c = get_char("Prompt: ");
double d = get_double("Prompt: ");
float f = get_float("Prompt: ");
int i = get_int("Prompt: ");
long l = get_long("Prompt: ");
string s = get_string("Prompt: ");

// deprecated as of fall 2017
long long ll = get_long_long("Prompt: ");

Documentation

See man get_* after installation, or CS50 Reference!

TODO

  • Add tests.

Contributors

More Repositories

1

python-cs50

This is CS50's library for Python.
Python
460
star
2

check50

This is check50, a command-line program with which you can check the correctness of your programs.
Python
349
star
3

submit50

This is submit50, CS50's command-line tool for submitting problems.
Python
322
star
4

docs

These are CS50 documents.
HTML
233
star
5

lectures

Source code for CS50's lectures
JavaScript
204
star
6

compare50

This is compare50, a fast and extensible plagiarism-detection tool.
Python
162
star
7

cs50.readthedocs.io

CSS
153
star
8

mario-demo

Basic Mario clone in LÖVE 2D
Lua
109
star
9

gd50

Source code for games used in GD50
Lua
93
star
10

problems

Checks for check50
Python
92
star
11

codespace

PHP
63
star
12

help50-deprecated

This is help50, a command-line tool that helps students understand error messages.
Python
61
star
13

style50

Python
41
star
14

labs

C
41
star
15

ide

PHP
34
star
16

ide-archived

CS50 IDE's Docker configuration for Cloud9
JavaScript
31
star
17

sandbox

Shell
30
star
18

spl

CS50's fork of Eric Roberts' Stanford Portable Library.
C
26
star
19

ide50-deb

Shell
23
star
20

render50

Python
20
star
21

checks

Checks for check50
Python
17
star
22

libcs50-java

CS50 Library for Java
Java
15
star
23

server

HTML
15
star
24

lab50.vsix

Inspired by https://github.com/lostintangent/workspace-layout/
TypeScript
15
star
25

ap-2020

Ruby
14
star
26

github

Python
13
star
27

cli50

This is CS50's command-line interface.
Python
13
star
28

cli

Dockerfile
12
star
29

video.cs50.net

JavaScript
12
star
30

lib50

This is lib50, CS50's own internal library used in many of its tools.
Python
11
star
31

jekyll-theme-cs50

This is @cs50's theme for Jekyll. Inspired by https://github.com/poole/hyde.
SCSS
11
star
32

harvard.cs50.simple

A plugin for CS50 IDE (and, in turn, Cloud9 IDE).
JavaScript
11
star
33

tracks

11
star
34

publish50-electron

JavaScript
9
star
35

ide50

This is ide50, a command-line script that facilitates using CS50 IDE offline.
Python
8
star
36

helpers

Helpers used by help50
Python
8
star
37

test

8
star
38

draw.cs50.io

JavaScript
7
star
39

php-cs50

CS50 Library for PHP
PHP
7
star
40

recordings

Acknowledgement and Authorization
7
star
41

check

Dockerfile
6
star
42

roku50

Brightscript
6
star
43

presentation-mode.vsix

TypeScript
6
star
44

ddb50.vsix

JavaScript
5
star
45

slack50

JavaScript
5
star
46

libcs50-cpp

This is CS50's library for C++.
Makefile
5
star
47

problems-old

Arduino
5
star
48

run50

JavaScript
5
star
49

ai50.vsix

TypeScript
5
star
50

harvard.cs50.debug

Start Cloud9's GUI debugger from the command line.
JavaScript
5
star
51

cs61

Dockerfile
4
star
52

mysql

Makefile
4
star
53

music-python

Python
4
star
54

distro

JavaScript
4
star
55

speller

Checking Speller
Python
4
star
56

hbs50

Python
4
star
57

travis-ci

This is CS50's Docker image for Travis CI.
Makefile
4
star
58

update50

Shell
3
star
59

cs50.vsix

TypeScript
3
star
60

extension-uninstaller.vsix

TypeScript
3
star
61

help.cs50.net

Python
3
star
62

check50-demo

C
2
star
63

baseimage

Dockerfile
2
star
64

id

Sample code for using CS50 ID to authenticate users via HarvardKey, Princeton CAS, or Yale CAS.
Python
2
star
65

draw50live

HTML
2
star
66

harvard.cs50.share

JavaScript
2
star
67

scratch50

Python
2
star
68

harvard.cs50.audioplayer

JavaScript
2
star
69

site50

CSS
2
star
70

fpm

Makefile
1
star
71

harvard.cs50.autocomplete

JavaScript
1
star
72

astyle

1
star
73

style50-demo

SIGCSE style50 demo
Python
1
star
74

config50

Language for specifying grade computation in cs50.me
Python
1
star
75

widgets

JavaScript
1
star
76

style50-server

HTML
1
star
77

smtp

PHP
1
star
78

sigcse

sigcse checks
Python
1
star
79

check50_js

Python
1
star
80

harvard.cs50.presentation

A plugin for CS50 IDE (and, in turn, Cloud9 IDE).
JavaScript
1
star
81

lang

1
star
82

harvard.cs50.theme

A plugin for CS50 IDE (and, in turn, Cloud9 IDE).
JavaScript
1
star
83

charlesriverx

Python
1
star
84

ide-issues

1
star
85

food50

JavaScript
1
star
86

server50-2012

Ruby
1
star
87

harvard.cs50.gist

JavaScript
1
star
88

libcs50-ruby

1
star
89

cscip14315

CSCI P-14315
Python
1
star
90

review50

Python
1
star
91

compare50-demo

C
1
star
92

phpliteadmin

PHP
1
star
93

server50

Python
1
star
94

harvard.cs50.info

A plugin for CS50 IDE (and, in turn, Cloud9 IDE).
JavaScript
1
star
95

harvard.cs50.style

JavaScript
1
star