Duplicate
Export
Register
ccc101(3)
1 Flashcard Deck
Send to Chat
AI Edit
Heading 3
Highlight
Here's your flashcard deck!
Send to Chat
AI Edit
Normal Text
Highlight
You can edit it by clicking the 'edit'! Once you have a few cards, you can begin to study it in full screen or use our AI study mode!
Flashcard Deck
Study
General form of a C program
The structure and layout of a C program, including the use of headers, main function, and other key components.
Basic elements in a C program
Includes data types, variables, assignment statements, input/output functions, and other fundamental building blocks in C programming.
Data types in C
Categories or classifications of data such as integer, float, double, character, etc., which determine the type of values that can be stored and manipulated in a program.
Declaration of variables
The process of specifying the data type and name of a variable in C, allowing it to be used to store and manipulate data in a program.
Assignment statements in C
Statements that assign values to variables, allowing the manipulation and updating of data within a C program.
Reading data values in C
The process of obtaining input data into a C program, often through functions like scanf(), to be used for computation and processing.
Displaying results in C
The output or presentation of computed data or information from a C program to the user, often achieved through functions like printf().
Format strings for data entry and display
Specifies the format for reading and displaying data in C, including the use of placeholders and formatting options with functions like scanf() and printf().
Software Development Method
A structured approach to developing software, involving problem definition, analysis, algorithm design, coding, testing, and maintenance.
Problem Definition
The initial phase where the problem to be solved by the software is clearly identified, along with its requirements and constraints.
Problem Analysis
The process of examining and understanding the problem in detail, including its inputs, outputs, processing requirements, and other relevant factors.
Algorithm Design and Representation
Creating a step-by-step plan or set of instructions for solving the problem, often represented using pseudocode or flowcharts.
Coding and Debugging
The process of translating the algorithm into a programming language (coding) and identifying and fixing errors or issues (debugging).
Conversion of kilometers to miles
Converting measurements in kilometers to equivalent values in miles, often involving multiplication by the conversion factor.
Conversion of miles to kilometers
Converting measurements in miles to equivalent values in kilometers, often involving multiplication by the conversion factor.
Data requirements for conversion program
Input data: distance in kilometers or miles Output: distance converted to miles or kilometers Relationship: 1 mile = 1.609 kilometers
Algorithm for converting miles to kilometers
1. Get the distance in miles 2. Convert the distance to kilometers (distance in kilometers = 1.609 * distance in miles) 3. Display the distance in kilometers
High-level programming language
Refers to a programming language that is closer to human language and easier to read and write, such as C, C++, Java, Python, etc.
Year of development of C programming language
1972, developed by Dennis Ritchie
Implement the algorithm as a program using the C programming language
Implementing the algorithm as a program using C involves translating the algorithm into C code according to the syntax rules of the language.
High-level programming language developed in 1972 by Dennis Ritchie at ATT Bell Laboratories
C is a high-level programming language developed in 1972 by Dennis Ritchie at ATT Bell Laboratories. It was designed to write the UNIX operating system and was originally used primarily for systems programming.
Preprocessor
The preprocessor is a system program that modifies a C program prior to its compilation. It processes the source code before it is passed to the compiler.
Preprocessor Directive
A preprocessor directive is a command that gives instructions to the preprocessor. It begins with a number symbol as its first nonblank character and is used to include header files, define constant macros, and more.
Library
In C programming, a library is a collection of useful functions and symbols that may be accessed by a program. It has a standard header file whose name ends with the symbols '.h'.
Function Body
In C programming, the function body refers to the remaining lines of the program enclosed in curly brackets. It consists of declarations and executable statements.
Main Function
Every C program has a main function, which marks the point where program execution begins. It is a mandatory part of a C program and contains the declarations and executable statements.
Define Directive
The define directive notifies the C preprocessor to replace each occurrence of the identifier NAME by value. It is used to define constant macros, and C program statements cannot change the value associated with the NAME constant macro.
Include Directive
The include directive causes the preprocessor to insert definitions from a standard header file into a program before compilation. It gives the program access to a library and tells the preprocessor where to find the meanings of standard identifiers used in the program.
Reserved Words
Reserved words in C are words that have special meaning and cannot be used for other purposes. They are all specified in lowercase and comprise a complete list of words with special meaning in the C language.
Reserved Words
A word that has special meaning in C and cannot be used for other purposes. All reserved words appear in lowercase. Here is a complete list specified by ANSI (American National Standards Institute).
Standard Identifiers
A word that has special meaning, but one that can be redefined and used by a programmer for other purposes. Redefinition is not recommended because C will no longer be able to use it for its original purpose. Example: printf, scanf.
User-Defined Identifiers
Identifiers chosen by a programmer to name memory cells that will hold data and program results. Example: KMSPERMILE, miles, kms, kMS, KMS.
Syntax Rules
1. An identifier must consist only of letters, digits, and underscores. 2. An identifier cannot begin with a digit. It can begin with a letter or an underscore. However, it is discouraged to start an identifier with an underscore because it can conflict with system names. 3. A C reserved word cannot be used as an identifier. 4. C compiler is case sensitive; identifiers that are composed of the same characters and symbols but differ in their uppercase and lowercase letters are considered different identifiers. 5. There is no rule on the length of an identifier. However, the first 31 characters of identifiers are discriminated by the compiler. So, the first 31 letters of two identifiers in a program should be different.
Good Programming Practice (Identifier Names)
1. Pick a meaningful name for user-defined identifiers so its use is easy to understand. 2. Choose identifiers long enough to convey meaning but avoid excessively long names because you are more likely to make a typing error in longer names. 3. Do not choose names that are similar, as confusion may arise.
Identifiers
User-defined names used to represent variables, functions, and other elements in a program.
Best Practice for Identifiers
1. Use identifiers that are easy to understand. 2. Choose names long enough to convey meaning but avoid excessively long names. 3. Avoid similar names. 4. Avoid choosing names that only differ in their uppercase and lowercase letters.
C Language
A high-level programming language known for its efficiency and flexibility, commonly used in system programming, embedded systems, and complex applications.
Elements of C Language
The building blocks of the C programming language, including data types, variables, operators, control structures, functions, and more.
Jennifer Joyce
A fictional name used as an example of an identifier.
M Montemayor
A fictional name used as an example of an identifier.
CCC101
An example of an identifier, possibly representing a course code or variable name.
Lecture 03
An example of an identifier, possibly representing a lecture number or variable name.
Valid Identifiers in C
Jennifer, Joyce, M, Montemayor, CCC101, Lecture, 03, MAXENTRIES, variable2, xYZ123, XyZ123, thisisalongone
Invalid Identifiers in C
1Letter, TWOFOUR, joes, double, part2, char, for, static, twitter, 4score, twos, CONSTTIME, helloworld, x2y1z0
Variable Declarations
Variable: a name associated with a memory cell whose value can change as the program executes. Variable Declarations: statements that communicate to the compiler the names of variables in the program and the kind of information stored in each variable.
Variable Declaration Syntax
Syntax: datatype variablelist Examples: int count, large double rate, time char middleinitial, char answer, int age
Data Types in C
Data Type: a set of values and operations that can be performed on those values. Standard Data Types in C: pre-defined data types e.g. int, char, double
Integer Data Types in C
Data Type: int used to represent integers in C. Not all integers can be represented due to the finite size of a memory cell.
Data Type: int
Used to represent integers in C. Integers are positive and negative real numbers. Whole numbers are integers because of the finite size of a memory cell. Not all integers can be represented. ANSI C specifies that the range must include at least the values -32767 through 32767.
Data Type: double
Used to represent real numbers in C. Real numbers have an integral part and a fractional part that are separated by a decimal point. Scientific notation can be used to represent real numbers (e.g. 1230000 = 123 x 10^5). C Scientific Notation: you can read E or e as 'times 10 to the power'.
Data Type: char
Used to represent an individual character value: a letter, a digit, or a special symbol. Each value is enclosed in single quotes. Represented in the memory as an integer whose value is determined by the code used by the C compiler. (e.g. A, z, 2, 9)
ASCII
American Standard Code for Information Interchange. Most common code used to specify the integer representing each character value.
Variable Data Types
- Number of children at school: int - Letter grade on an exam: char - Average number of school days a student is absent each year: double - First letter of your last name: char - Number of cars passing through an intersection in an hour: int - Area of a circle in square inches: double
Assignment Statement
An instruction that stores a
Absences per year
If your last name is Montemayor, double the first letter of your last name (M) to get 'MM', then convert to a number by taking its position in the alphabet: M=13. So the answer is 13.
Number of cars passing through an intersection in an hour
Integer value.
Area of a circle in square inches
Double value.
Assignment Statement
An instruction that stores a value or computational result in a variable. In C, the symbol '=' is the assignment operator and is read as 'becomes' or 'gets'. Example: sum = sum + item;
Variable expression
Executable Statements. Follow after the declarations in a function. C statements used to write or code the algorithm and its refinements. C compiler translates these into executable machine language; the computer executes the machine language version of these statements when we run the program.
Valid and invalid constants in C
Valid: 15E2 (double), 35 (int), 'h' (char), 37491 (double), 912 (double), 45e3 (double). Invalid: PQR (invalid), true (invalid), 4719 (invalid).
Program
A set of instructions that tell a computer what to do.
Executable Statement
A statement that is written as a program to be carried out by the computer.
Jennifer Joyce M Montemayor
Seems to be a name. Please provide more context for a flashcard definition.
CCC101
A course code, please provide more context for a flashcard definition.
Lecture 03
A specific lecture in a course. Please provide more context for a flashcard definition.
Assignment Statement
A single char variable nextletter is assigned the character value A by the assignment statement nextletter = 'A'.
Executable Statements
Instructions in a program that can be executed, such as variable assignments, function calls, and IO operations.
IO Operations and Functions
An alternative way of storing values or computational results into a variable, done by copying data from an input device into a variable.
Input Operation
An instruction that copies data from an input device into memory.
Output Operation
An instruction that displays information stored in memory.
IO Functions
C functions that perform input and output operations. The most common functions are supplied as part of the C standard input/output library, to which we gain access through the preprocessor directive.
Function Call
Activating a function, analogous to asking a friend to perform an urgent task. You tell them what to do, not how to do it, and wait for your friend to report back that the task is finished. It consists of the function name and function arguments.
Calling the printf Function
The printf function is called with function arguments enclosed in round brackets following the function name. It provides information needed by the function to print the listed variables or expressions whose values are displayed. If the print list has several variables, the format string should contain the same number of placeholders.
Calling the printf Function Syntax
printf(format string, print list)
Format String
A sequence of characters enclosed in quotes which specifies the form of the output. It contains placeholders, which are symbols beginning with '%' in a format string that indicate where to display the output value. It also contains an abbreviation for the type of data it represents.
Formatting Numbers in Program Output
The number of columns used to display a value is called field width. Digits are displayed right-justified.
Multiple Placeholders
Format strings can have multiple placeholders. C matches variables with placeholders in left-to-right order.
Field width
The value is called field width, digits are displayed right-justified. Formatting Values of Type int.
Multiple Placeholders
Format strings can have multiple placeholders. C matches variables with placeholders in left-to-right order.
Calling the scanf Function
Copies into memory data typed at the keyboard by the program user during program execution. Syntax: scanf("format string", input list). Example: scanf("%lf %d", &miles, &firstinitial); The format string is a quoted sequence of placeholders; one placeholder for each variable in the input list.
Executable Statements
Must indicate both the total field width needed and the number of decimal places desired. Jennifer Joyce M Montemayor CCC101 Lecture 03 49
return Statement
Syntax: return expression Example: return 0 transfers control from a function back to the activator (caller) of the function. The value of expression is returned as the result of the function execution. Jennifer Joyce M Montemayor CCC101 Lecture 03 50
Output Display
Show the output displayed by the following program lines when the data entered are 5 and 7: printf("Enter two integers"); scanf("%d %d", &m, &n); m = 5; n = 3; printf("%d %d", m, n);
User Input
Write a statement that asks the user to type three integers and another statement that stores the user responses into first, second, and third.
Circle Area Calculation
Write a program that asks the user to enter the radius of a circle and then computes and displays the circle's area. Use the formula: Area = PI x Radius x Radius, where PI is the constant macro 3.14159.
Standard Data Types
List 3 standard data types of C.
Data Display Statement
The average pH of citrus fruits is 2.2, and this value has been stored in the variable avgcitruspH. Provide a statement to display this information in a readable way.
Algorithm for Integer Operations
Write an algorithm that allows for the input of an integer value, doubles it, subtracts 10, and displays the result. Jennifer Joyce M Montemayor CCC101 Lecture 03 53: General Form of a C.
avgcitruspH
Stored variable for average citrus pH.
Displaying avgcitruspH
Write a statement to display the average citrus pH in a readable way: printf("The average citrus pH is %.2f", avgcitruspH);
Algorithm for integer manipulation
1. Input an integer value 2. Double the input 3. Subtract 10 from the doubled value 4. Display the result
General Form of a C Program
1. Preprocessor directives 2. Main function heading 3. Declarations 4. Executable statements
Send to Chat
AI Edit
Normal Text
Highlight
Continue adding your notes here.
Scholarly Assistant's Insights
Explore C programming basics: program structure, data types, variables, and assignment statements. Get ready to learn!
C Programming
Programming
Software Development
Data Types
Variables
+27 more
Ask Scholarly Assistant
Similar Pages
Login to Leave a Comment
Give your feedback, or leave a comment on a page to share your thoughts with the community.
Login