您的位置:首页 > 职场人生

程序设计考试大纲(高级程序员级)

2007-12-13 16:54 316 查看
The following little code shows the effects of .rodata, .data and .bss sections.

 

#include <stdio.h>

// y_readonly is in data seciton. "123" is in rodata section.
// y_readonly is a poniter variable. And compiler sets the value of y_readonly
// to the address "123".
char *y_readonly = "123";

// "abc" is in data section. j_data is the address of "abc" not a pointer
// variable.
char j_data[] = "abc";

// bss section
char bss_data[3000];

int main(int argc, const char *argv[]) {
// Trigger segement fault
// y_readonly[0] = 'X';

return 0;
}

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: