Fundamentals of Computer Programming - strona 9

note /search

File inclusion

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

File inclusion  Any source line of the form #include " filename " or #include is replaced by the contents of the file filename  Where is the file included - for ”f ilename .h” - in the same directory, where the source program (if not found - like ) - for - in a directory defined by th...

Log and Exp

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

Log, exp...  exp(x) exponential function e x  log(x) natural logarithm ln(x), x 0  log10(x) base 10 logarithm log 10 (x), x 0  pow(x,y) x y ; a domain error occurs if x=0 and y=0 ...

Make and a Makefile

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

make and a Makefile  A typical makefile contains lines of the following types: - macros (”variable definitions”) - dependency rules  explicit rules  implicit rules - comments  Example: # Our...

Signal

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

 Often used in Unix systems  Facilities for handling exceptional conditions that arise during execution: - interrupt signal from an external source - an error in execution. void (*signal(int sig, void (*handler) (int))) (int)  signal determines how subsequent signals will be handled  If handle...

Standard Predefined Macros

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

Standard Predefined Macros  __FILE__ - This macro expands to the name of the current input file, in the form of a C string constant  __LINE__ - This macro expands to the current input line number, in the form of a decimal integer constant  Example

Trigonometric functions

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

Trigonometric functions  Angles are always expressed in radians  Parameters and results are doubles - sin(x) sine of x - cos(x) cosine of x - tan(x) tangent of x - asin(x) sin -1 (x), x in [-1,1] - acos(x) cos -1 (x), x in [-1,1] - atan(x) tan -...

Strncpy

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

Strncpy  char *strncpy(char *dest, const char *src, size_t maxlen);  Copies at most maxlen characters of src to dest  The target string might not be null-terminated if the length of src is maxlen or more #include #include int main(void) { char string[10]; char *str1 = "first"; strncp...

Strstr

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

Strstr  char *strstr(const char *s1, const char *s2);  strstr scans s1 for the first occurrence of the substring s2  On success, strstr returns a pointer to the element in s1 where s2 begins (points to s2 in s1)  If s2 does not occur in s1, st...

A singly linked list

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

A singly linked list • One of the simplest data structures • Consists of a number of nodes, each containing: - one or more data element(s) - a link (pointer) to another node ...

Adding integers to pointers

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

Adding integers to pointers double *pd; double t[10]; pd = &(t[5]); printf(”%p\n”,pd); /* 0065FB60 */ pd = pd + 3; printf(”%p\n”,pd); /* 0065FB78 */ /* now pd points to t[8] */ ...