TA name: Brian Chen

Tutorial TUT0005: Thursday 9-10AM, at IC220.

Email Policy:
Before emailing me, consider attending my practical or posting the question on Piazza. My email address is brianyx.chen[at]mail.utoronto.ca. When emailing me, use your utoronto email and in the subject include "CSCA48".


Weekly Notes:   Note - these are not a replacement, but instead a supplement for weekly tutorials

The tutorial this week covered basics in C such as loops, conditionals, comparison operators, and how to use printf in C.

We discovered that the | and & operators are bitwise operators - meaning they actually take the bit-by-bit of two variables (e.g. 2 = 00000010). We then discussed how the || and && are logical operators - meaning that they act the same as (a or b) and (a and b) in Python. Do not use single operators in place of double operators . We also briefly touched upon the fact that anything not 0 is True in C.

We examined the behavior of these different operators through some code:
int a = 2;
int b = 0;
int c = 7;
if((a=b && (c=3) & b==0)){
  printf("Printed \n");
  printf("Not printed \n");
return 0;
We also created a program to print all the perfect squares from [1..100] in C:
int is_square(int num){
  double ans = sqrt((double)num);
  int int_ans = (int) ans;
  if(ans == int_ans){
     return sqrt(num);
  return 0;

int main(){
  for(int i = 1; i < 101; i++){
   int ans = is_square(i);
   if(ans != 0){
     printf("%d = %d * %d \n", i, ans, ans);
There were no tutorials this week.
Instead here's a link to a funny comic - Dilbert Programming Environment.

We will be using C for this course. Consider familiarizing yourself with the C language and get started by downloading a text editor (I recommend Notepad++ or Sublime Text for beginners, and Visual Studio Code for more advanced students). Try to understand how to write and run C code (most text editors have syntax highlighting, which is useful!) - it's quite a bit different than Python. Read Paco's notes on the Quercus site for details.

Looking to store your code? Try not to use Google Drive or Dropbox, instead, consider checking out Git - a version control system widely used by software engineers. I recommend setting up a GitHub (Git hosting service) account - GitHub offers a free student pack loaded with goodies here. Git is a storage system for your code, being able to revert to previous versions, accessed from any computer, and loads of other amazing functionality that makes developing much easier.