0% found this document useful (0 votes)
7 views6 pages

Pointer: Int* ; =& (biến khác) Or int* =& (biến khác) Char 1 byte

Uploaded by

Toàn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

Pointer: Int* ; =& (biến khác) Or int* =& (biến khác) Char 1 byte

Uploaded by

Toàn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

POINTER

Int* <biến>;

<biến>=&(biến khác)

Or int* <biến>=&(biến khác)

Char 1 byte

Có char
Trỏ đè :int* <biến đè> = (int*)p;
-A pointer is a variable, which contains the address of a memory location of another variable, A
pointer provides an indirect method of accessing the value of a data item

-Some situations where pointers can be used are:

To modify outside arguments of a function

To return more than one value from a function

To pass array and strings more conveniently from one function to another

To manipulate arrays easily by moving pointers to them instead of moving the arrays itself

To allocated memory and access it (Direct memory allocation)

• Thuật ngữ: Computer program: A set of instructions that computer hardware will execute.

• Issues for a program/software: Usability, Correctness, Maintainability, Portability

• Computer software: A set of related programs

• Steps to develop a software: Requirement collecting, Analysis, Design, Implementing,


Testing, Deploying, Maintaining

• Data: Specific values that describe something

• Information: Mean of data

• Fundamental Data Units: Bit, Nibble, Byte, KB, MB, GB, TB


• Data Representation: Number systems: 2, 10, 8, 16

• Program Instructions: <opcode, operand1, operand 2>

• Programming Languages: Machine language, Assembly, High-level languages

A variable is a name referencing to a memory location (address)

Structure of a program code should be organize in a manner so that it is understandable,


testable and readily modifiable

• Structure of a loop:

– Initial block.

– Condition.

– Task in each execution.

• Types of iteration: fixed loops, variable loops

• The iteration constructs are:

while

do while

for

C includes three keywords that allow jumps across statements: goto, continue, and break

GUIDELINES

• Limit line length to 80 characters - both comments and code

• Avoid global variables

• Select data types for variables wisely and carefully

• Initialize a variable when declaring it only if the initial value is part of the semantic of the
variable.

• If the initial value is part of an algorithm, use a separate assignment statement.

• Avoid goto, continue, break except in switch.

• Avoid using the character encodings for a particular machine.

• Use a single space or no spaces either side of an operator.

• Use in-line opening braces or start opening braces on a newline but don't mix the two styles.

• Initialize iteration variables in the context of the iteration

• Avoid assignments nested inside logical expressions

• Avoid iterations with empty bodies - reserve the body for the algorithm

• Limit the initialization and iteration clauses of a for statement to the iteration variables
• Distribute and nest complexity

• Avoid fancy algorithms that may be efficient but are difficult to read

• Add additional comments where code has been fine tuned for efficient execution

• Add an extra pair of parentheses where an assignment is also used as a condition

• Remove unreferenced variables

• Remove all commented code and debugging statements from release and production code

(Software)A portion of a program that carries out a specific small function and may be used alone or
combined with other modules to create a program.

Natural thinking: A large task is divided into some smaller tasks

Cohesion is a measure of the focus within a module

Coupling is a measure of the degree of interrelatedness of a module to its referring module(s).

Function prototypes describe the form of a function without specifying the implementation details

Global variables->data segment

Local variables->stack segment

Not fclose-fgetchar

You might also like