Skip to content

Commit

Permalink
Merge pull request #56 from stoyanK7/9.4_C-pointers_fix-typos-print-s…
Browse files Browse the repository at this point in the history
…tatements

fix typos in print statements
  • Loading branch information
syreal17 authored Jul 18, 2024
2 parents 293c15f + 2ccfd78 commit b6a9704
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions chapters/c.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,14 @@ int main() {
printf("\n This is arr[0]: %c ", arr[0]);
printf("\n This is *arr: %c ", *(arr+0));
//as well as:
printf("\n This is arr[0]: %c ", arr[1]);
printf("\n This is *(arr+0): %c ", *(arr+1));
printf("\n This is arr[1]: %c ", arr[2]);
printf("\n This is *(arr+1): %c ", *(arr+2));
printf("\n This is arr[2]: %c ", arr[3]);
printf("\n This is *(arr+2): %c ", *(arr+3));
printf("\n This is arr[3]: %c ", arr[4]);
printf("\n This is *(arr+3): %c ", *(arr+4));
printf("\n This is arr[1]: %c ", arr[1]);
printf("\n This is *(arr+1): %c ", *(arr+1));
printf("\n This is arr[2]: %c ", arr[2]);
printf("\n This is *(arr+2): %c ", *(arr+2));
printf("\n This is arr[3]: %c ", arr[3]);
printf("\n This is *(arr+3): %c ", *(arr+3));
printf("\n This is arr[4]: %c ", arr[4]);
printf("\n This is *(arr+4): %c ", *(arr+4));
//understanding that, you can see now why in C, a thing that looks very weird as the following, makes sense:
printf("\n This is 1[arr]: %c ", 1[arr]);
//As you see, it printed 'e', because that expression is just *(1+a), which is the same as *(a+1)
Expand Down

0 comments on commit b6a9704

Please sign in to comment.