Dr inż. Piotr Fabian - strona 2

Data types and sizes

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 840

Data types and sizes • There are only a few basic data types in C: - char a single byte, capable of holding one character in the local character set, usually 8 bits - int an integer, typically reflecting the natural size of integers on the host ma...

Enumeration constants - examples

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 581

Enumeration constants • An enumeration is a list of constant integer values, as in enum boolean { NO, YES }; • The first name in an enum has value 0, the next 1, and so on, unless explicit values are specified. • If not all values are specified, unspecified values continue the progression from the ...

Fahrenheit to Celsius - examples

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 693

A problem to solve: temperature conversion Fahrenheit Celsius • Gabriel Daniel Fahrenheit introduced a temperature scale in 1714 - Fahrenheit originally defined body temperature as a dozen (12) degrees and an ice/water/salt mixture as 0° F. Later, he divided each degree into 8 parts, obtaining 96° ...

Ferror - examples

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 819

Ferror Tests for an error on a stream. int ferror( FILE * stream ); • 0 means: no error has occurred on stream • Otherwise: a nonzero value • The ferror routine tests for a reading or writing error on the file associated with stream • If an error has occurred, the error indicator for the stream rem...

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 959

Fread • Prototype: size_t fread( void * buffer , size_t size , size_t count , FILE * stream ); • Parameters: buffer Storage location for data size Item size in bytes count Maximum number of items to be read stream Pointer to FILE structure • Reads...

Functions in C - examples

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 595

Functions in C A function definition has this form: return-type function-name(paramet er declarations, if any) { declarations statements } Example: /* power: raise base to n-th power; n = 0 */ int power(int base, int n) { int i, p; /* local variab...

Fwrite - overview

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 777

Fwrite • Prototype (like fread): size_t fwrite( void * buffer , size_t size , size_t count , FILE * stream ); • Parameters (like fread): buffer Storage location for data size Item size in bytes count Maximum number of items to be read stream Pointer

High level languages - overview

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 658

High level languages • 1946: Plankalkul , Konrad Zuse • 1949: Short Code • 1951: A-0 , Grace Hopper • 1957: FORTRAN , John Backus • 1959: LISP • 1958: COBOL • 1960: ALGOL 60 • 1962: APL • 196...

History - overview

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 749

History • 1623-24 : Wilhelm Schickard, mechanical calculator • 1642 : Blaise Pascal, adding machine • 1670 : Gottfried Wilhelm Leibnitz, multiplying machine • 1804 : Joseph Marie Jacquard: programmable weaving machine • 1822 :

Initialization of arrays

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 539

Initialization of arrays • An array may be initiallized - filled with provided values • Example: int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } • When the array size is omitted: the compiler counts initializers and sets the size t...