C Flashcards
What is the main method in C?
-Starting point of your C application
-Returns an int
-If returned value is not provided, defaults to return 0
What is 0 indicate by convention?
Valid exit
What does a non-zero indicated by convention
Some kind of error to the calling program
What are C programs complied into?
Object code by a compiler
What does the pre-processor cpp do ?
It examines the source code before the compiler:
-it identifies any special cpp directives
-it re-writes source code into an intermediate source file
-it passes the new source file to the compiler
What are the 3 forms of cpp directives?
1.File inclusion:
-#include <file>: paste a file directly into your source code
2.Macros:
-#define <content>: these are pure textual substitutions
3.Conditional inclusions:
-#ifndel <label></label></content></file>
What is important to remember about cpp directives?
They are not part of the C language. Gcc never knows anything about them, because it only sees the extended output created by cpp.
What is an example of a standard header file ?
stdio.h
Why is it important to have header files?
They contain declarations for various functions–> declarations provide basic type information for the compiler.
Since the compiler compiles each source file independently, it does not know that this function is properly defined in another source file.
What does #include <stdio.h> do?</stdio.h>
It includes a declaration for the printf() function
What is the error “Symbol could not be resolved” mean?
You have probably forgotten the associated header file.
What is the basic form use of printf()?
printf(formatting string, variable list);
What are the 5 main C data types?
d :decimal integer
f :floating point value
s :character string
c :individual character
p :pointer address value
C is a … language?
An imperative, procedural language
What are imperative languages?
They use a series of statements, each of which can modify the state of the program.