2

Great question. When you call the printf function, it takes in a string format as a parameter. The % within this string tells the printf function what datatype to look for and to print. See https://reference.cs50.net/stdio/printf where it explains how the %i, %c and other datatypes can be referenced in a printf function. So to give an example: When you ...


1

So, Here is the deduction: If it didn’t rain, Harry visited Hagrid today. Harry visited Hagrid or Dumbledor today, but not both. Harry visited Dumbledor today. Harry did not visit Hagrid today. Using sentence 3, we know that Harry visited Dumbledor. Using sentence 2, we know Harry did not visit both Hagrid and Dumbledor. so it must not have visited Hagrid ...


1

If it didn’t rain, Harry visited Hagrid today. Harry visited Hagrid or Dumbledor today, but not both. Harry visited Dumbledor today. Harry did not visit Hagrid today. Deduction: It rained today. From point 3, we know that Harry visited Dumbledor today. From point 2, we know that Harry visited Hagrid or Dumbledor today but not both. Based on points 2 and 3, ...


1

int sigma(int m) { if (m <= 0) return 0; else return (m + sigma(m - 1)); } The last line is where "magic" happens, because sigma calls itself with m decremented by one each time, each call is getting closer and closer to our base case of m = 0. When m = 0, our function will reverse, instead of adding to the stack, it will ...


1

A recursive function typically consists of two main steps base case step recursive step A recursive function basically keeps calling itself until the base case is reached. In the first example above, the base case is m <= 0. It appears from the recursive call (i.e., sigma(m - 1)) that the argument of the function sigma is decreased by 1 which means that ...


Only top voted, non community-wiki answers of a minimum length are eligible