CPSC 355 Lecture Notes - Lecture 25: .Bss, Global Variable, Segmentation Fault

131 views5 pages

Document Summary

Cpsc 355 - lecture 25 nov 14th. Global variables: scope: global (from declaration onwards, lifetime: life of program, are stored in a separate section of ram, eg: // global variable int val; main( ) { int f( ) { val = 3; int a; a = val; Static global variables: scope: local to file (from declaration onwards, lifetime: life of program, stored in a separate section of ram, eg: // global static variable static int val main( ) { val = 3; Programs may allocate 3 sections of memory: text. Attempts to write to this memory causes segmentation fault: data. Is read/write memory: bss (block starting symbol) These sections are located in low memory, just after the section reserved for the os kernel: low. Pseudo-ops are used to indicate that what follows goes into a particular section: . text. Is the default section when assembling: . data, . bss.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents