100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

CP104 week 1 lecture notes full and complete

Rating
-
Sold
-
Pages
2
Uploaded on
20-05-2023
Written in
2022/2023

IN depth notes on the first week of david browns class









Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
May 20, 2023
Number of pages
2
Written in
2022/2023
Type
Class notes
Professor(s)
David brown
Contains
All classes

Content preview

Notes on Variables in Computer Science

Introduction:
Variables are fundamental elements in computer science and programming. They play a crucial
role in storing and manipulating data during program execution. This set of notes will provide an
overview of variables, their types, declaration, assignment, and scope in computer science.

1. Definition:
- A variable is a named location in computer memory that holds a value, which can be modified
during program execution.
- It acts as a placeholder or container for storing data, allowing programmers to manipulate and
retrieve values as needed.

2. Variable Types:
- Primitive Types: Basic data types provided by programming languages, including integers,
floating-point numbers, characters, and booleans.
- Composite Types: More complex data types constructed from primitive types, such as arrays,
strings, structures, and classes.

3. Variable Declaration:
- Declaration is the process of introducing a new variable to the program.
- It involves specifying the variable's name and type to allocate memory accordingly.
- Syntax: `<type> <variable_name>;`

4. Variable Assignment:
- Assignment involves assigning a value to a variable after declaration.
- Syntax: `<variable_name> = <value>;`

5. Variable Initialization:
- Initialization is the process of assigning an initial value to a variable at the time of declaration.
- Syntax: `<type> <variable_name> = <value>;`

6. Variable Scope:
- Scope defines the portion of the program where a variable is accessible and can be referred
to.
- Local Scope: Variables declared within a specific block or function, accessible only within that
block.
- Global Scope: Variables declared outside of any specific block, accessible throughout the
program.
- Scope resolution: The process of determining which variable to use when there are variables
with the same name but different scopes.

7. Variable Naming Conventions:
CA$20.45
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
goodfink19

Get to know the seller

Seller avatar
goodfink19
View profile
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
5
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions