W1: A Simple Calculation Flashcards
How does an application work?
The app receives an input from the user, converts it into output, then displays it on user’s screen.
Program instructions are used to store the input data in RAM, retrieve input from RAM, convert it in the CPU, and store the result in RAM.
What are constant values?
Numbers, characters, or string literals. Each constant is of a specific type.
How do you define a numeric constant in hexadecimal representation?
Add ox in the prefix
Ex. const int x = ox5c // same as const int x =92
What type are all character constants? How do you define a character constant?
Char type. The ways of defining a character constant are:
- the digit or letter enclosed in single quotes ( ‘1’)
- the decimal value from the collating sequence
- the hexadecimal value from the collating sequence
What is an escape sequence?
A special action or symbol
What is a string literal?
A sequence of characters within a pair of double quotes.
Ex. “This is C”
What does the function ‘scanf’ do?
Accepts data from the user and stores the data in memory at the address of the specified program variable.
Ex. scanf(format,address);
What is a format?
A string literal that describes how to convert text entered by user into data stored in memory.
The format contains the conversion specifier for translating the input characters
Ex. %c = character (char)
%d = decimal (int, short)
%f = floating point (float)
%lf = floating point (double)
What is an address?
Contains the address of the variable.
Prefix ‘&’ is used to refer to the address of a variable
What is an operand?
A placeholder for the variable or constant.
What does the printf instruction do?
Prints the value or variable to the user.
Ex. printf(format, expression);