CS136 Lecture 3: Module 3

45 views5 pages

Document Summary

You can"t have nested comments with multi-lines i. e. /* comment /* c */ */ dtype can be either a string or a variable. ; racket constant: (define my-number 42) const -> represents that the variable is immutable int -> declares the type of the variable name. Style underscore_style or camelcasestyle, avoid names that begin with underscores, i. e. (_me) (continuously adding/changing) i. e. (define dtype (cond [(>= x 0) 42] [else invalid])) (identifier must be known prior to program running) i. e. const int stype = 42; C uses infix algebraic notation (i. e. 3+ 3) 11:42 pm return x * x; voidkeyword is used to indicate a function has no parameters. No need for contract type because part of definition. Known as the modulo operator, i. e. const int a = 21 % 2; // 1. Avoid use the % (remainder operator) with negative integers. A function is passed arguments, and returnsa value. // my_sqr(x) squares x int my_sqr(const int x) {

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers