Programming C Flashcards
What does printf do?
print commands write a string which is output on screen
What does scanf do?
Reads from the standard input stream until whitespace can read numbers and letters. Scanf requires variable declaration
What does fgets do?
similar to scanf but can read whitespace and only needs variable
How do we read whitespaces with scanf?
use the command %[^\n]
What is the purpose of escape sequences?
Allows the programmer to format the output
Give examples of format specifiers
%d (decimal integer)
%lf(double)
%Lf (long double)
%s (a string)
Define a variable in C
Areas in the memory where data is stored and accessed
What are some tips for naming variables?
Always begin with lowercase letters
Declare all variables at the start of the code
What does strlen do?
returns the length of the string (ignorning the string terminator)