diff --git a/c_pointers/chapter_5.c b/c_pointers/chapter_5.c new file mode 100644 index 0000000..c3adceb --- /dev/null +++ b/c_pointers/chapter_5.c @@ -0,0 +1,26 @@ +#include +#include +#include + + +int main(void) { + + // print size of char & character literal + printf("%zu\n", sizeof(char)); + printf("%zu\n", sizeof('a')); + + + + // when a string is not a constant + // doesn't work with gcc anymore, also with -Wno-deprecated-writable-strings + // gives 'Bus error: 10' + { + char *tabHeader = "Sound"; + *tabHeader = 'L'; + printf("%s\n", tabHeader); + } + + + return 0; + +} \ No newline at end of file