Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
$ cat hello.c
#include <stdio.h>
int main(void)
{
printf("hello, world");
}
$ gcc -S hello.c
$ head -n 4 hello.s
.file "hello.c"
.section .rodata
.LC0:
.string "hello, world"$ cat hello.c
int main(void)
{
char *x = "hello, world";
x[0] = 'a';
return 0;
}
$ gcc -W -Wall hello.c
$ ./a.out
Ошибка сегментирования$ gcc -W -Wall -Wwrite-strings -g hello.c
hello.c: In function ‘main’:
hello.c:3: warning: initialization discards qualifiers from pointer target typeЧто будет напечатано в консоли после выполнения кода?
Найм персонала: О важности примитивных вопросов