Fundamentals of Computer Programming - strona 6

note /search

The Year 2038 Bug

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

The Year 2038 Bug  Tuesday, January 19, 2038, GMT 03:14:07  The counter will overflow and go to negative numbers  Proposed solution: use 64-bits numbers - moves the problem to Sunday, December 4 th , year 292 277 026 596 - would be a total solut...

Trigraph sequences

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

Trigraph sequences  The characters in C source: 7-bit ASCII  Some character sets don 't cover ASCII  For reduced sets: trigraph sequences  Replaced by the corresponding single character  Replacement occurs before any other processing ??= # ??( [ ?? } ??' ^ ??! | ??- ~  Replacement occurs befo...

Strcat

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

Strcat  char *strcat(char *dest, const char *src);  strcat appends a copy of src to the end of dest  The length of the resulting string is strlen(dest) + strlen(src)  strcat returns a pointer to the concatenated Strings #include #include int...

Strchr

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

Strchr  char *strchr(const char *s, int c);  Scans a string for the first occurence of a given character  The null-terminator is considered to be part of the string  If c does not occur in s, returns NULL #include #include int main() { char string[20]; char *ptr, c = 'r'; strcpy(string, "...

Strcmp

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

Strcmp  int strcmp(const char *s1, const char*s2);  strcmp performs an unsigned comparison of s1 to s2  Returned value: - 0 if s1 s2 #include #include int main() { char *buf1 = "alice", *buf2 = "andrew"; int p; p = strcmp(buf2, buf1); if (p 0)

Strcpy

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

Strcpy  char *strcpy(char *dest, const char *src);  Copies string src to dest - (order of arguments: like in an assignment ”dest=src”) #include #include int main() { char string[10]; /* long enough to hold a copy of str1 */ char *str1 = "first"; strcpy(string, str1);

Strpbrk

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

Strpbrk  char *strpbrk(const char *s1, const char *s2);  strpbrk scans a string, s1, for the first occurrence of any character appearing in s2  On success, strpbrk returns a pointer to the first occurrence of any of the characters in s2  If no...

Strtok

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

Strtok  char *strtok(char *s1, const char *s2);  strtok considers the string s1 to consist of a sequence of zero or more text tokens, separated by spans of one or more characters from the separator string s2  The first call to strtok - returns a po...

Summary of functions operating on raw memory

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

Summary of functions operating on raw memory  memccpy copies a block of n bytes from src to dest  memcpy copies a block of n bytes from src to dest  memmove copies a block of n bytes from src to dest  memchr searches the first n bytes of array ...

Inserting a new element

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

Inserting a new element: int insert(bn *p, bn **root) { if (*root && (*root)-data == p-data) return 1; /* already present */ if (!*root) { /* empty tree */ *root = p; return 0; } else if (p-data (*root)-data) insert(p,&((*root)-right)); else insert(p,&((*root)-left)); return 0; } i...