Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
472 B

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. int main(void) {
  5. // print size of char & character literal
  6. printf("%zu\n", sizeof(char));
  7. printf("%zu\n", sizeof('a'));
  8. // when a string is not a constant
  9. // doesn't work with gcc anymore, also with -Wno-deprecated-writable-strings
  10. // gives 'Bus error: 10'
  11. {
  12. char *tabHeader = "Sound";
  13. *tabHeader = 'L';
  14. printf("%s\n", tabHeader);
  15. }
  16. return 0;
  17. }