Open Course Study Notes-[Harvard] Computer Science CS50 (2)

Source: Internet
Author: User
Tags integer division

Lesson 1 C language, source code, compiler (1)-2011.10.11

Programming philosophy, extracted from the format syntax of the statement. This section describes loop, logical expressions, arrays, abstract concepts, and examples of C statements. Source code, compiler, GCC-ohello hello. C, make hello, GCC-O hello. c-LCs50(Load libary ). Describes functions.

Every user can register a name on a server created in cs50 and log on via ssh. This is also known as cloud. cloud is a term of 10 thousand.

Like the previous open classes, comments are very important. At the beginning of the program, comments are used to describe the content and author of the program.

This section describes the primitive types, such as float, Int, Char, and bool. Character '\ R', returns to the leftmost, so sometimes we can see that the line feed is "\ r \ n", while the Mac is only "\ r ".

Lesson 2 C language, source code, compiler (2)-2011.10.19

The parameter-ggdb after GCC is used for commissioning. I still like to use printf and use-ddebugx to define whether to set macro definitions, the tested statements should not be followed by # ifdefdebugx. It seems that the advanced Commissioning method has not been used.

Sizeof is used to detect the storage space occupied by data. Long is still 4 in Linux (at least in some machines), which is equivalent to int. You can use the Longlong type with a length of 8. These lengths are related to machines and systems.

This section describes the Problem and Solution of integer division.

Describes the usage, logic judgment, switch statement, for statement, while statement, and do {} while () Statement of IF () {} else. Linux man usage. In fact, I like VI and also like to compile and run it using commands.

Class 1 functions, global variables, parameters, return values (1)-2011.10.20

Note the overflow problem when changing the typecasting type. For float operations, due to limited storage locations, 32-bit or 64-bit operations, there will be precision problems. Pay attention to the floating point size comparison. For example, 0.81 + 0.03 = 0.84 is not necessarily true.

Loop nesting is introduced. Int main (INT argc, char ** argv) {} or the meaning of the parameter. Processing of Operation overflow.

Class 2 functions, global variables, parameters, return values (2)-2011.10.24

Describes some operators that need to pay attention to syntax writing methods. Next, we will introduce the function and the memory allocation method. The memory is Heap from top to bottom. It is used to allocate global variables, including static and dynamic resources, from bottom to stack, and is used to allocate local variables and functions. Use intmain (int argc, char * argv []) to introduce the concept of command line operations and arrays.

Related Links: My articles related to programming ideas

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.