Politechnika Śląska - strona 320

note /search

Operating on pointers - overview

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

Operating on pointers • Pointers may be: - compared - subtracted - incremented by an integer (scaled!) - decremented by an integer (scaled!) • Adding 1 to a pointer increments the address by the size of the pointed type • Pointers may not be added...

Our memory - overview

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

Our memory • Humans have (at least) two kinds of memory: - large: durable, but troublesome to fill (the write access time is long) - small: vanishing after a few seconds, but easy to fill • Small means really small : about 7 objects ...

Pointers memory - overview

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

Pointers - accessing memory int x; pti = &x; x = 6; *pti = *pti + 1; /* now x is 7 */ x++; printf(”%d”,x); /* now 8 */ ...

Pointers - overview

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

Pointers • A pointer is an address, usually pointing to something useful in the memory • Defining variables storing addresses: * • Example: int...

Precedence and Order of Evaluation

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

Precedence and Order of Evaluation Operators Associativity () [] - . left to right ! ~ ++ -- + - * ( type ) sizeof right to left * / % left to right + - left to right left to right = left to right == != left to right & left to right ^ left to right | left to right && left to right || ...

Printing a string without printf

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

Printing a str ing without printf #include int main() { char s[] = "Hello again!\n"; char *p; p = s; while (*p) /* smart? */ putchar (*p++); return 0; } ...

Printing all elements - overview

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

Printing all ele ments p=head; /* begin with the first */ /* element */ while (p) { printf("%lf ",p-x); p = p-next; } ...

String constants - overview

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

String constants • A string constant , or string literal , is a sequence of zero or more characters surrounded by double quotes • Example: "The first string" • String constants can be concatenated at compile time: "hello, " &qu...

Structures may be nested

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

Structures may be nested typedef struct { char name[50]; struct { int ye, mo, da; } birthdate; } tperson; tperson p1; strcpy(p1.name,"John Smith"); p1.birthdate.ye = 1945; p1.birthdate.mo = 1; p1.birthdate.da = 17; ...

The asterisk - overview

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

The asterisk * as width and/or precision specifier • A width or precision may be specified as * • The value is computed by converting the next argument, which must be an int • Example: