100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CS214-C Programming Notes Pensacola Christian College $25.59   Add to cart

Exam (elaborations)

CS214-C Programming Notes Pensacola Christian College

 0 view  0 purchase
  • Course
  • Institution

CS214-C Programming Notes Pensacola Christian College

Preview 4 out of 60  pages

  • August 30, 2023
  • 60
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Ethanhope. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $25.59. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

76800 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$25.59
  • (0)
  Add to cart