DEV Community

Dmytro Lobanov
Dmytro Lobanov

Posted on

1

CS50's Introduction to Computer Science - Week 1 / Notes

https://manual.cs50.io/
Full notes: https://cs50.harvard.edu/x/2024/notes/1/
Practice: https://cs50.harvard.edu/x/2024/psets/1/

To start we should know 3 main keys:

  • how to write commands
  • how to compile commands
  • how to run commands
code filename.c // create a file

// compiles the file from our instructions in C and creates an executable file called
make filename

./filename // run
Enter fullscreen mode Exit fullscreen mode

Building blocks:

  • Functions
  • Variables
  • Conditionals
  • Loops
  • Operators
  • Comments

Types and format codes

Types refer to the possible data that can be stored within a variable. Types are very important because each type has specific limits.
The number of bits limits how high and low we can count.

  • bool, a Boolean expression of either true or false
  • char, a single character like a or 2 and takes 8 bits(1 byte);
  • double, a floating-point value with more digits than a float
  • float, a floating-point value, or real number with a decimal value (32 bits = 4 bytes);
  • int, integers up to a certain size (always 32 bits = 4 bytes), or number of bits
  • long, integers with more bits so that they can count higher than an int
  • string, a string of characters

printf allows for many format codes, full list https://manual.cs50.io/3/fprintf

int     %i
float   %f
char    %c
string  %s
Enter fullscreen mode Exit fullscreen mode

AI Agent image

How to Build an AI Agent with Semantic Kernel (and More!)

Join Developer Advocate Luce Carter for a hands-on tutorial on building an AI-powered dinner recommendation agent. Discover how to integrate Microsoft Semantic Kernel, MongoDB Atlas, C#, and OpenAI for ingredient checks and smart restaurant suggestions.

Watch the video 📺

Top comments (0)

Jetbrains image

Is Your CI/CD Server a Prime Target for Attack?

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. It makes sense—CI/CD servers have access to source code, a highly valuable asset. Is yours secure? Check out nine practical tips to protect your CI/CD.

Learn more

👋 Kindness is contagious

If this post resonated with you, feel free to hit ❤️ or leave a quick comment to share your thoughts!

Okay