100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CS214-C Programming Notes Pensacola Christian College

Rating
-
Sold
-
Pages
60
Grade
A+
Uploaded on
30-08-2023
Written in
2023/2024

CS214-C Programming Notes Pensacola Christian College

Institution
Course











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

Written for

Course

Document information

Uploaded on
August 30, 2023
Number of pages
60
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CS 214 - C Programming Notes
Author: Mali Payani
Lecturer: Dr Jonathan Sparks

CS 214 - Lecture 1- CH. 2
Intro to the C Language

Background:
 Core programming language

Why C?
 Powerful
 Syntax similar to other languages
 Structured high-level language
 Efficient
 Reusable through libraries
 Mature and wide accepted

C's History:
Timeline:
 1960s- ALGOL (Algorithm)
 1967- BCPL (Martin Richards) Basically Combined Programming Language
 1970- B Language (Ken Thompson)
 1972- C language (Dennis Ritchie)
 1989- ANSI C standardization
 1999- Major C standard update
 2011- Minor C Update

Basic Parts of a Program:
1. Preprocessor Directives
2. Global Declarations
3. Local Declarations
4. Statements
5. Other Functions

,CS 214 - Lecture 2
Steps to Program:
The basic steps are:
1. Understand: understanding what the problem is will help us to find a solution.
2. Plan (Risk Analysis): finding a solution (flow charts).
3. Code: Implementation
4. Compile
5. Test
6. Implement: Publishing app to the public
 Don't forget to documentation. Documentation is for other coders.

Error Types:
 Syntax
 Prevents a program from compiling
 Error message may help solve these.
 Misspelling, punctuation, spacing
 Logic (a problem with the implementation)
 Prevents a program from running properly.
 More subtle (painful)-the joy of programming
 Example: Start at 1, count by 2's until counter equals 100.
 Programs can run with logic errors.
 Testing is important here.

#Page 32

Comments
 Describes a function or code block's purpose.
 Block comment: /* text*/
 Line Comments: // (1999 Standard)
 Don't overuse.
 Can appear anywhere a space can but cannot be nested.

Structure of a C Program: pg. 32
 Preprocessor Directives
 Global Directives
 Local Directives
 Statements
 Other functions as required

Preprocessor Directives (like a to-do list):
#include <stdio.h>
- Tells the compiler to do something before compiling.
- Appears at the beginning of the code.
- Begins with a '#'

,CS 214 - Lecture 3
 #include includes a header file or library (like java's 'import')
 Appendix G-pg. 1071: writing your own libraries
 Line the # all the way to the lef
 No space between # and 'include'
 stdio- standard input/output: allows user to write on the screen (printf function)
What are Libraries?
 Additional features (mostly functions) which can be available to the program.
 C is a small language-libraries extend it as needed. ex. #include <stdio.h>
 Standard libraries are available for all. <stdio.h>; printf
o Standard libraries available: Appendix F - pg. 1059
 Programmers can create their own so that they themselves or other programmers can access it.

The main() function
 int main(void) /*int returns an integer value. It is not required
to type void. All it means is it doesn't receive anything as it's
running.*/
{
declaration section
statement section
}

 A main() is required!
 The program begins and ends with main()
 It calls other functions.

The printf() Function:
 printf() is a standard library function from <stdio.h>
 You cannot use the printf without <stdio.h>
 This library is used for most programs.
 Items between parentheses of a function are called parameters or arguments.
ex. printf("Hello world!"); // the string is the parameter or argument.

printf() Control Codes:
 "escape sequences" are used for special things.
 Control codes begin with a '\'
 List of codes: pg. 48
 Carriage return returns to next line.

Variable Identifiers:
 Name referring to a place in memory where data or objects can be stored or a box that holds something.
 A variable has a:
o Name
o Type
o Value
o Address

,  Using a variable name accesses the value stored at that memory location.

Identifier Naming: see pg. 37
 First character must be alphabetical character or underscore
 Must consist only of alphabetical characters, digits, or underscores.
 First 63 characters of an identifier are significant.
 Cannot duplicate a keyword.




CS 214 - Lecture 4

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Ethanhope Chamberlain College Of Nursng
Follow You need to be logged in order to follow users or courses
Sold
99
Member since
5 year
Number of followers
97
Documents
2789
Last sold
6 months ago

4.4

20 reviews

5
15
4
2
3
0
2
1
1
2

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