C Flashcards
Week 2.4, 2.5, 2.6, 2.7, 2.8 (163 cards)
why level language is C
low-level, high-level
why is C high-level
we can write code in a natural language
why is C low-level
we can precisely control use of and access to memory
what programming paradigm is C
imperative
what are available in C and not in python
pointers
for both python and C are they compiled or interpreted
python - interpreted
C - compiled
define byte-code
- abstraction of machine code
- platform independent and portable
- cannot run directly on hardware
libraries in C syntax
include <stdio.h></stdio.h>
#include <math.h></math.h>
how are functions scope defined
{}
what is not relevant in C
indentation - but still highly advised for readability
what is needed after every C line
;
what do we use to compile C
GNU compiler collection - gcc
what does the compiler do
converts plain-text source code to a file of executable mahine code
what are the 2 type of compiler messages
- errors
- warnings
what is a compiler message error
- fatal to the compilation process
- language syntax errors
what is a compiler message warning
- may not be fatal but indicate issues to address
- may still produce an executable
what are 3 primitive data types in C
- int
- float
- char
define static typing
- type of variable determined at compile-time & remains fixed
- produces more efficient compiled code
define dynamic typing
- type of variable is determined at run-time & can be changed
- problematic due to mis-matches
define strong typing
- type of variable must be declared
- different types of variable cannot be mixed
define weak typing
- type of variable not needed to be declared
- different types of variables can be combined - implicit type conversion
what typing does C use
statically & weakly typed
- BUT has elements of strong typing - variable declaration
how is C stored in memory
- C language standard does not define how much each memory type uses
○ They are generally constrained by machine architecture
○ and by the compiler and machine-specific language definition - sets a minimum
- further reason that C is not fully portable between platforms
3 types of integers & their sizes
- int = 4 bytes minimum
- short int = 2 bytes
- long int = 8 bytes
- also unsigned int types