SlideShare a Scribd company logo
Prepared by
Mohammed Sikander
Technical Lead
Cranes Software International Limited
int g_var = 5;
int main( )
{
int l_var = 8;
}
mohammed.sikander@cranessoftware.com 2
00000000 D g_var
00000000 T main
• Symbol table does not contain the
entries of local/automatic variables.
• gl is stored in Initialized Data Segment
• main is stored inText / Code Segment
int global = 5;
static int stglobal = 9;
int main( )
{
int local = 8;
static int stlocal = 3;
}
mohammed.sikander@cranessoftware.com 3
00000000 D global
00000000 T main
00000004 d stglobal
00000008 d stlocal.0
• d stands for Internal Linkage
• External variables will not have any
name mangling.
• Internal Linkage variables might have
name mangling.
1. Can we have two static
variables with same name
but different functions.
2. What is the memory
segment of x.
3. How does the compiler
avoid name clashes.
mohammed.sikander@cranessoftware.com 4
void print( )
{
static int x = 5;
}
void display( )
{
static int x = 8;
}
int main( )
{
}
00000005 T display
0000000a T main
00000000 T print
00000000 d x.0
00000004 d x.1
Compiler uses different names for x.
int x = 5;
int main( )
{
int x = 10;
printf(“x = %d n “ , x);
}
mohammed.sikander@cranessoftware.com 5
static int x = 5;
int main( )
{
static int x = 10;
{
static int x = 12;
printf(“x = %d n “ , x);
}
}
FILE1.C
int x = 5;
void func( );
int main( )
{
func( );
}
FILE2.C
int x = 8;
void func( )
{
printf(" x = %d n" , x);
}
mohammed.sikander@cranessoftware.com 6
• Compile file1.c
• Compile file2.c
• Link file1.o and file2.o
• Observe the output
mohammed.sikander@cranessoftware.com 7
• [sikander@localhost nm]$ gcc file1.c -c
• [sikander@localhost nm]$ gcc file2.c –c
• [sikander@localhost nm]$ gcc file1.o file2.o
• file2.o(.data+0x0): multiple definition of `x'
• file1.o(.data+0x0): first defined here
• collect2: ld returned 1 exit status
[sikander@localhost nm]$ nm file1.o
U func
00000000 T main
00000000 D x
[sikander@localhost nm]$ nm file2.o
00000000 T func
U printf
00000000 D x
FILE1.C
static int x = 5;
void func( );
int main( )
{
printf(__func__ );
printf(" x = %d n",x);
func( );
}
FILE2.C
static int x = 8;
void func( )
{
printf("%s x = %d n" ,__func__ , x);
}
mohammed.sikander@cranessoftware.com 8
• Compile file1.c
• Compile file2.c
• Link file1.o and file2.o
• Observe the output
mohammed.sikander@cranessoftware.com 9
• $ gcc -c file1.c
• $ gcc -c file2.c
• $ gcc file1.o file2.o
• $ ./a.out
• main x = 5
• func x = 8
$ nm file1.o
U func
00000000r __func__.0
00000000T main
U printf
00000000 d x
$ nm file2.o
00000000T func
00000000r __func__.0
U printf
00000000 d x
080495dc d x
080495e0 d x
FILE1.C
int x = 5;
void func( );
int main( )
{
printf(__func__ );
printf(" x = %d n",x);
func( );
}
FILE2.C
extern int x;
void func( )
{
printf("%s x = %d n" ,__func__ , x);
}
mohammed.sikander@cranessoftware.com 10
• Compile file1.c
• Compile file2.c
• Link file1.o and file2.o
• Observe the output
FILE1.C
int x = 5;
void func( );
int main( )
{
printf(__func__ );
printf(" x = %d n",x);
func( );
}
FILE2.C
extern int x;
void func( )
{
printf("%s x = %d n" ,__func__ , x);
}
mohammed.sikander@cranessoftware.com 11
• Compile file1.c
• Compile file2.c
• Link file1.o and file2.o
• Observe the output
mohammed.sikander@cranessoftware.com 12
• $ gcc -c file1.c
• $ gcc -c file2.c
• $ gcc file1.o file2.o
• $ ./a.out
 main x = 5
 &x = 0x8049618
 func x = 5
 &x = 0x8049618
]$ nm file1.o
U func
00000000 r __func__.0
00000000 T main
U printf
00000000 D x
]$ nm file2.o
00000000 T func
00000000 r __func__.0
U printf
U x
$nm a.out
08049618 D x
FILE1.C
static int x = 5;
void func( );
int main( )
{
printf(__func__ );
printf(" x = %d n",x);
func( );
}
FILE2.C
extern int x;
void func( )
{
printf("%s x = %d n" ,__func__ , x);
}
mohammed.sikander@cranessoftware.com 13
• Compile file1.c
• Compile file2.c
• Link file1.o and file2.o
• Observe the output
mohammed.sikander@cranessoftware.com 14
• $ gcc -c file1.c
• $ gcc -c file2.c
• $ gcc file1.o file2.o
• file2.o(.text+0xb): In function `func':
• : undefined reference to `x‘
• collect2: ld returned 1 exit status
]$ nm file1.o
U func
00000000 r __func__.0
00000000 T main
U printf
00000000 d x
]$ nm file2.o
00000000 T func
00000000 r __func__.0
U printf
U x
static int x = 5;
int main( )
{
int x;
printf(“x = %d n”,x);
}
static int x = 5;
int main( )
{
extern int x;
printf(“x = %d n”,x);
}
int a = 5;
int b;
static int c = 7;
static int d;
int main( )
{
}
• Mention the memory segments of variables after
compiling (.o file) and after linking (a.out)
• What is the difference between a and c.
• Use nm utility to view the memory segments
$gcc –c file.c
$nm file.o
$gcc file.c
$nm ./a.out
 $ gcc file.c -c
 $ nm file.o
 00000000 D a
 00000004 C b
 00000004 d c
 00000000 b d
 00000000 T main
mohammed.sikander@cranessoftware.com 18
•“C” The symbol is common.
• Common symbols are uninitialized
data.
• When linking, multiple common
symbols may appear with the same
name.
• If the symbol is defined anywhere, the
common symbols are treated as
undefined references.$ nm a.out
08049534 D a
08049544 B b
08049538 d c
08049540 b d
int x ;
int main( )
{
printf(“Main &x= %p” , &x);
printf(“x = %d n”, x);
func( );
}
int x ;
void func( )
{
printf(“Func &x= %p” , &x);
printf(“x = %d n”, x);
}
$ nm file1.o
U func
00000000 T main
U printf
00000004 C x
]$ nm file2.o
00000000 T func
U printf
00000004 C x
$nm a.out
08049600 B x
int x ;
int main( )
{
printf(“Main &x= %p” , &x);
printf(“x = %d n”, x);
func( );
}
int x = 5 ;
void func( )
{
printf(“Func &x= %p” , &x);
printf(“x = %d n”, x);
}
$ nm file2.o
00000000T func
U printf
00000000 D x
$ nm file1.o
U func
00000000 T main
U printf
00000004 C x
$nm a.out
08049600 D x
C C
B
C D
D
D D
Multiple Definition
d d
NoConflict, two different variables
b b
NoConflict, two different variables
d b
NoConflict, two different variables
b d
NoConflict, two different variables
b D
NoConflict, two different variables
void func( );
int x = 5; //D
int main( )
{
printf(“Main &x= %p” , &x);
printf(“x = %d n”, x);
func( );
}
int x = 10; //D
void func( )
{
printf(“Func &x= %p” , &x);
printf(“x = %d n”, x);
}
void func( );
static int x = 5; //d
int main( )
{
printf(“Main &x= %p” , &x);
printf(“x = %d n”, x);
func( );
}
int x = 10; //D
void func( )
{
printf(“Func &x= %p” , &x);
printf(“x = %d n”, x);
}
const int gc = 10;
static const int gsc = 12;
int main( )
{
const int lc = 5;
static const int lsc = 8;
}
00000000 R gc
00000004 r gsc
00000008 r lsc.0
00000000 T main
const int gc = 15; //ReadOnly
int main( )
{
const int lc = 5; //Stack
printf(“Enter the value for local const variable : “);
scanf(“ %d”,&lc);
printf(“LocalConst = %d n” , lc);
printf(“Enter the value for global const variable : “);
scanf(“ %d”,&gc);
printf(“GlobalConst = %d n”,gc);
}
[sikander@localhost ~]$ ./a.out
Enter the value for local const variable : 89
LocalConst = 89
Enter the value for global const variable : 6
Segmentation fault
 [sikander@localhost ~]$ nm f1.o
 00000000 t display
 0000000a T main
 00000005 T print
static void display()
{
}
void print()
{
}
int main( )
{
display( );
print( );
}
 For any queries and feedback
 Mail to
 Mohammed.sikander@cranessoftware.com
 sikander1248@gmail.com
mohammed.sikander@cranessoftware.com 26

More Related Content

DOCX
C++ 260 MCQ Question with Answer for all Units
ODP
White box ppt
PPT
White box testing-200709
PPT
Collections in Java
PPT
Oop Presentation
PPTX
Gof design patterns
PPTX
Object oriented programming in python
PPTX
Android data binding
C++ 260 MCQ Question with Answer for all Units
White box ppt
White box testing-200709
Collections in Java
Oop Presentation
Gof design patterns
Object oriented programming in python
Android data binding

What's hot (20)

PPTX
Introduction to oop
PPTX
Object oriented programming in python
PPTX
SOLID - Principles of Object Oriented Design
PPT
GCC compiler
PPTX
Conditional Statement in C#
PPTX
Type casting
PPSX
PPTX
Directed Acyclic Graph Representation of basic blocks
PDF
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
PDF
Lab report for Prolog program in artificial intelligence.
PDF
PPT
C++ classes tutorials
PPT
Object-oriented concepts
PPTX
Introduction to Object Oriented Programming
PPT
Programming paradigm and web programming
PPT
PPTX
[OOP - Lec 08] Encapsulation (Information Hiding)
PDF
Your code sucks, let's fix it
PPTX
object oriented Programming ppt
Introduction to oop
Object oriented programming in python
SOLID - Principles of Object Oriented Design
GCC compiler
Conditional Statement in C#
Type casting
Directed Acyclic Graph Representation of basic blocks
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Lab report for Prolog program in artificial intelligence.
C++ classes tutorials
Object-oriented concepts
Introduction to Object Oriented Programming
Programming paradigm and web programming
[OOP - Lec 08] Encapsulation (Information Hiding)
Your code sucks, let's fix it
object oriented Programming ppt
Ad

Viewers also liked (18)

PDF
Internationalization in Jakarta Struts 1.3
PPTX
UPPS in health 20151021
PDF
Corinna_Tutor_Resume_10_2
PDF
Pubblicazioni Chiave sull'Unione Europea
PDF
Coaching Clinic Rusun Karang Anyar 6 Oct 2015
PPTX
Citizenship stage 2 health
PDF
Anno Europeo dello Sviluppo
PPTX
C++ programming Unit 5 flow of control
PPT
Química nos veículos automotores 3°4
PPTX
Adfactors
PDF
Konsep dasar asuhan kehamilan poltekkes sby
PDF
FMD 492 E Final Evaluation
PDF
[대학생 연합 해커톤 UNITHON 3RD] Mingginyu_ppt
DOCX
Standar asuhan keperawatan
DOCX
askeb Bayi sehat dengan imunisasi campak
PPT
PDF
UDI. CURSO Intef. Competencias Clave. el desarrollo y el impacto de la tecnol...
Internationalization in Jakarta Struts 1.3
UPPS in health 20151021
Corinna_Tutor_Resume_10_2
Pubblicazioni Chiave sull'Unione Europea
Coaching Clinic Rusun Karang Anyar 6 Oct 2015
Citizenship stage 2 health
Anno Europeo dello Sviluppo
C++ programming Unit 5 flow of control
Química nos veículos automotores 3°4
Adfactors
Konsep dasar asuhan kehamilan poltekkes sby
FMD 492 E Final Evaluation
[대학생 연합 해커톤 UNITHON 3RD] Mingginyu_ppt
Standar asuhan keperawatan
askeb Bayi sehat dengan imunisasi campak
UDI. CURSO Intef. Competencias Clave. el desarrollo y el impacto de la tecnol...
Ad

Similar to Understanding storage class using nm (20)

PPT
Cquestions
PPT
C questions
PPT
C tutorial
PPT
C tutorial
PPT
C tutorial
DOCX
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
PPTX
Understand more about C
PPTX
CS50 2022 - Lecture 2 - Arrays.pptx
PDF
ANSI C REFERENCE CARD
DOCX
C interview question answer 2
PPTX
Functions in c
PPTX
Beginner's guide to linkers
PPTX
Introduction%20C.pptx
PPT
C tutorial
DOCX
fds unit1.docx
PDF
Data structure week 1
PPT
C Tutorials
PPTX
C programming(part 3)
PDF
0100_Embeded_C_CompilationProcess.pdf
Cquestions
C questions
C tutorial
C tutorial
C tutorial
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
Understand more about C
CS50 2022 - Lecture 2 - Arrays.pptx
ANSI C REFERENCE CARD
C interview question answer 2
Functions in c
Beginner's guide to linkers
Introduction%20C.pptx
C tutorial
fds unit1.docx
Data structure week 1
C Tutorials
C programming(part 3)
0100_Embeded_C_CompilationProcess.pdf

More from mohamed sikander (14)

PPTX
C++ 11 range-based for loop
PPTX
Pointer level 2
PDF
Implementing stack
PDF
Implementation of c string functions
PPTX
PPTX
Function basics
PDF
C++ Question on References and Function Overloading
PDF
Polymorphism
PDF
Inheritance and polymorphism
PDF
Container adapters
PDF
Implementing string
PDF
Operator overloading
PDF
Stl algorithm-Basic types
PDF
Static and const members
C++ 11 range-based for loop
Pointer level 2
Implementing stack
Implementation of c string functions
Function basics
C++ Question on References and Function Overloading
Polymorphism
Inheritance and polymorphism
Container adapters
Implementing string
Operator overloading
Stl algorithm-Basic types
Static and const members

Recently uploaded (20)

PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
System and Network Administration Chapter 2
ISO 45001 Occupational Health and Safety Management System
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Online Work Permit System for Fast Permit Processing
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Softaken Excel to vCard Converter Software.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Design an Analysis of Algorithms II-SECS-1021-03
How to Choose the Right IT Partner for Your Business in Malaysia
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PTS Company Brochure 2025 (1).pdf.......
How Creative Agencies Leverage Project Management Software.pdf
Operating system designcfffgfgggggggvggggggggg
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
System and Network Administration Chapter 2

Understanding storage class using nm

  • 1. Prepared by Mohammed Sikander Technical Lead Cranes Software International Limited
  • 2. int g_var = 5; int main( ) { int l_var = 8; } mohammed.sikander@cranessoftware.com 2 00000000 D g_var 00000000 T main • Symbol table does not contain the entries of local/automatic variables. • gl is stored in Initialized Data Segment • main is stored inText / Code Segment
  • 3. int global = 5; static int stglobal = 9; int main( ) { int local = 8; static int stlocal = 3; } mohammed.sikander@cranessoftware.com 3 00000000 D global 00000000 T main 00000004 d stglobal 00000008 d stlocal.0 • d stands for Internal Linkage • External variables will not have any name mangling. • Internal Linkage variables might have name mangling.
  • 4. 1. Can we have two static variables with same name but different functions. 2. What is the memory segment of x. 3. How does the compiler avoid name clashes. mohammed.sikander@cranessoftware.com 4 void print( ) { static int x = 5; } void display( ) { static int x = 8; } int main( ) { } 00000005 T display 0000000a T main 00000000 T print 00000000 d x.0 00000004 d x.1 Compiler uses different names for x.
  • 5. int x = 5; int main( ) { int x = 10; printf(“x = %d n “ , x); } mohammed.sikander@cranessoftware.com 5 static int x = 5; int main( ) { static int x = 10; { static int x = 12; printf(“x = %d n “ , x); } }
  • 6. FILE1.C int x = 5; void func( ); int main( ) { func( ); } FILE2.C int x = 8; void func( ) { printf(" x = %d n" , x); } mohammed.sikander@cranessoftware.com 6 • Compile file1.c • Compile file2.c • Link file1.o and file2.o • Observe the output
  • 7. mohammed.sikander@cranessoftware.com 7 • [sikander@localhost nm]$ gcc file1.c -c • [sikander@localhost nm]$ gcc file2.c –c • [sikander@localhost nm]$ gcc file1.o file2.o • file2.o(.data+0x0): multiple definition of `x' • file1.o(.data+0x0): first defined here • collect2: ld returned 1 exit status [sikander@localhost nm]$ nm file1.o U func 00000000 T main 00000000 D x [sikander@localhost nm]$ nm file2.o 00000000 T func U printf 00000000 D x
  • 8. FILE1.C static int x = 5; void func( ); int main( ) { printf(__func__ ); printf(" x = %d n",x); func( ); } FILE2.C static int x = 8; void func( ) { printf("%s x = %d n" ,__func__ , x); } mohammed.sikander@cranessoftware.com 8 • Compile file1.c • Compile file2.c • Link file1.o and file2.o • Observe the output
  • 9. mohammed.sikander@cranessoftware.com 9 • $ gcc -c file1.c • $ gcc -c file2.c • $ gcc file1.o file2.o • $ ./a.out • main x = 5 • func x = 8 $ nm file1.o U func 00000000r __func__.0 00000000T main U printf 00000000 d x $ nm file2.o 00000000T func 00000000r __func__.0 U printf 00000000 d x 080495dc d x 080495e0 d x
  • 10. FILE1.C int x = 5; void func( ); int main( ) { printf(__func__ ); printf(" x = %d n",x); func( ); } FILE2.C extern int x; void func( ) { printf("%s x = %d n" ,__func__ , x); } mohammed.sikander@cranessoftware.com 10 • Compile file1.c • Compile file2.c • Link file1.o and file2.o • Observe the output
  • 11. FILE1.C int x = 5; void func( ); int main( ) { printf(__func__ ); printf(" x = %d n",x); func( ); } FILE2.C extern int x; void func( ) { printf("%s x = %d n" ,__func__ , x); } mohammed.sikander@cranessoftware.com 11 • Compile file1.c • Compile file2.c • Link file1.o and file2.o • Observe the output
  • 12. mohammed.sikander@cranessoftware.com 12 • $ gcc -c file1.c • $ gcc -c file2.c • $ gcc file1.o file2.o • $ ./a.out  main x = 5  &x = 0x8049618  func x = 5  &x = 0x8049618 ]$ nm file1.o U func 00000000 r __func__.0 00000000 T main U printf 00000000 D x ]$ nm file2.o 00000000 T func 00000000 r __func__.0 U printf U x $nm a.out 08049618 D x
  • 13. FILE1.C static int x = 5; void func( ); int main( ) { printf(__func__ ); printf(" x = %d n",x); func( ); } FILE2.C extern int x; void func( ) { printf("%s x = %d n" ,__func__ , x); } mohammed.sikander@cranessoftware.com 13 • Compile file1.c • Compile file2.c • Link file1.o and file2.o • Observe the output
  • 14. mohammed.sikander@cranessoftware.com 14 • $ gcc -c file1.c • $ gcc -c file2.c • $ gcc file1.o file2.o • file2.o(.text+0xb): In function `func': • : undefined reference to `x‘ • collect2: ld returned 1 exit status ]$ nm file1.o U func 00000000 r __func__.0 00000000 T main U printf 00000000 d x ]$ nm file2.o 00000000 T func 00000000 r __func__.0 U printf U x
  • 15. static int x = 5; int main( ) { int x; printf(“x = %d n”,x); }
  • 16. static int x = 5; int main( ) { extern int x; printf(“x = %d n”,x); }
  • 17. int a = 5; int b; static int c = 7; static int d; int main( ) { } • Mention the memory segments of variables after compiling (.o file) and after linking (a.out) • What is the difference between a and c. • Use nm utility to view the memory segments $gcc –c file.c $nm file.o $gcc file.c $nm ./a.out
  • 18.  $ gcc file.c -c  $ nm file.o  00000000 D a  00000004 C b  00000004 d c  00000000 b d  00000000 T main mohammed.sikander@cranessoftware.com 18 •“C” The symbol is common. • Common symbols are uninitialized data. • When linking, multiple common symbols may appear with the same name. • If the symbol is defined anywhere, the common symbols are treated as undefined references.$ nm a.out 08049534 D a 08049544 B b 08049538 d c 08049540 b d
  • 19. int x ; int main( ) { printf(“Main &x= %p” , &x); printf(“x = %d n”, x); func( ); } int x ; void func( ) { printf(“Func &x= %p” , &x); printf(“x = %d n”, x); } $ nm file1.o U func 00000000 T main U printf 00000004 C x ]$ nm file2.o 00000000 T func U printf 00000004 C x $nm a.out 08049600 B x
  • 20. int x ; int main( ) { printf(“Main &x= %p” , &x); printf(“x = %d n”, x); func( ); } int x = 5 ; void func( ) { printf(“Func &x= %p” , &x); printf(“x = %d n”, x); } $ nm file2.o 00000000T func U printf 00000000 D x $ nm file1.o U func 00000000 T main U printf 00000004 C x $nm a.out 08049600 D x
  • 21. C C B C D D D D Multiple Definition d d NoConflict, two different variables b b NoConflict, two different variables d b NoConflict, two different variables b d NoConflict, two different variables b D NoConflict, two different variables
  • 22. void func( ); int x = 5; //D int main( ) { printf(“Main &x= %p” , &x); printf(“x = %d n”, x); func( ); } int x = 10; //D void func( ) { printf(“Func &x= %p” , &x); printf(“x = %d n”, x); } void func( ); static int x = 5; //d int main( ) { printf(“Main &x= %p” , &x); printf(“x = %d n”, x); func( ); } int x = 10; //D void func( ) { printf(“Func &x= %p” , &x); printf(“x = %d n”, x); }
  • 23. const int gc = 10; static const int gsc = 12; int main( ) { const int lc = 5; static const int lsc = 8; } 00000000 R gc 00000004 r gsc 00000008 r lsc.0 00000000 T main
  • 24. const int gc = 15; //ReadOnly int main( ) { const int lc = 5; //Stack printf(“Enter the value for local const variable : “); scanf(“ %d”,&lc); printf(“LocalConst = %d n” , lc); printf(“Enter the value for global const variable : “); scanf(“ %d”,&gc); printf(“GlobalConst = %d n”,gc); } [sikander@localhost ~]$ ./a.out Enter the value for local const variable : 89 LocalConst = 89 Enter the value for global const variable : 6 Segmentation fault
  • 25.  [sikander@localhost ~]$ nm f1.o  00000000 t display  0000000a T main  00000005 T print static void display() { } void print() { } int main( ) { display( ); print( ); }
  • 26.  For any queries and feedback  Mail to  Mohammed.sikander@cranessoftware.com  sikander1248@gmail.com mohammed.sikander@cranessoftware.com 26