Fundamentals of Computer Programming - strona 16

note /search

Other features

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 490

Other features  Available features depend on the version of make  makedepend - a program creating dependencies in Makefiles  imake - C preprocessor interface to the make utility  used to generate Makefiles from a template, a set of cpp macro...

Other Preprocessor Commands

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 504

Other Preprocessor Commands  #error text of error message generates an appropriate compiler error message  Example #ifdef OS_MSDOS #include #elifdef OS_UNIX #include "default.h" #els...

Quick Sort

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 448

Quick Sort  Find a random element x  Place elements = x in the right part  Call the function recursively for both parts (if they are longer than 1 element)  Complexity: O( n log n ) ( ...

Reading files

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 511

Reading files  A file may be rewound • may be done instead of storing a line in a buffer  A common task: saving and reading variables in/from files  How to organize a file  Binary file (closed format)  Text file (editable, larger, more dangerous)  Text files  Own format / syntax  XML ...

Signals

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 448

Signals  SIGABRT abnormal termination, e.g., from abort  SIGFPE arithmetic error, e.g., zero divide or overflow  SIGILL illegal function image, e.g., illegal instruction  SIGINT interactive attention, e.g., interrupt  SIGSEGV illegal storage ...

The gets function

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 378

The gets() function  Do not use this function!  It does not know how many characters can be safely stored in the string passed to it  Thus, if too many are read, memory will be corrupted  Use the fgets() function instead and read from stdin  R...

The preprocessor

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 427

The preprocessor  Preprocessing is the first step in the C program translation  The preprocessor provides its own language  It can be a very powerful tool to the programmer  All preprocessor directives or commands begin with a # ...

Time measurement

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 14
Wyświetleń: 448

Time measurement  Functions: asctime ctime difftime ftime gettime gmtime localtime mktime settime time_t tzset  Continuous time in seconds - Starting date: January 1st, 1970 - Type: long int (signed, 32-bits integer) - Maximum value: 2 31 -1 = 2 147 483 647 - What happens in 2 31 -1 seconds from ...

To use macros with parameters

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 287

To use macros with parameters or not to use  In C: useful, but be careful  In C++: better use templates ...

Memset

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 630

Memset  void *memset (void *s, int c, size_t n);  memset sets the first n bytes of the array s to the character c  Returns s ...