Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

Variable Modifiers − Auto & Extern

365.1K views
•
March 9, 2018
by
Neso Academy
YouTube video player
Variable Modifiers − Auto & Extern

TL;DR

Explains auto and extern modifiers in C programming with examples.

Transcript

Read and summarize the transcript of this video on Glasp Reader (beta).

Key Insights

  • Auto variables are automatically destroyed after their scope ends, which helps in efficient memory management.
  • Using 'auto' keyword is redundant as variables are auto by default, and uninitialized auto variables contain garbage values.
  • Global variables are initialized to zero by default, unlike auto variables that contain garbage values if not initialized.
  • Extern modifier is used for declaring a variable without defining it, allowing access to variables from other files.
  • Extern variables are declared to inform the compiler about their type without allocating memory.
  • Multiple declarations of extern variables are allowed, but multiple definitions within the same scope are not.
  • Linker is responsible for linking extern variables to their definitions across different files in a project.
  • When an extern variable is initialized, it is considered defined, and memory is allocated for it.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What is the purpose of the auto modifier in C?

The auto modifier in C is used to declare automatic variables, which are local to the function or block they are defined in. They are automatically destroyed once the function or block ends, freeing up memory. However, using the 'auto' keyword is redundant as variables are automatic by default.

Q: How does the extern modifier work in C programming?

The extern modifier in C is used to declare a variable without defining it, which means memory is not allocated at the point of declaration. It is typically used to access a variable defined in another file, allowing for modular programming. The linker resolves the actual definition during the linking process.

Q: Can you initialize an extern variable in C?

Yes, you can initialize an extern variable in C. When an extern variable is initialized, it is considered as both declared and defined, meaning memory is allocated for it. This is an exception to the usual behavior where extern only declares a variable without allocating memory.

Q: What happens if an extern variable is not found during linking?

If an extern variable's definition is not found during linking, the linker throws an error indicating an undefined reference. This is because the compiler assumes the variable exists based on the extern declaration, but the linker is responsible for resolving its actual location in the code.

Q: Why is using 'auto' keyword often unnecessary in C?

Using the 'auto' keyword is often unnecessary in C because variables declared within a function or block are automatically considered auto by default. Therefore, explicitly using the 'auto' keyword does not provide any additional functionality or benefits.

Q: How does memory allocation differ between auto and extern variables?

For auto variables, memory is allocated when the variable is defined within a function or block and is automatically deallocated when the scope ends. In contrast, extern variables are only declared without allocation at the point of declaration; memory is allocated only when the variable is defined elsewhere.

Q: What role does the linker play with extern variables?

The linker plays a crucial role in resolving extern variables by linking their declarations to their actual definitions across different files in a project. It ensures that the declared extern variables are properly linked to their defined counterparts, allowing for modular code structure.

Q: Are multiple declarations of extern variables allowed in C?

Yes, multiple declarations of extern variables are allowed in C as long as they occur in different scopes or files. However, only one definition is permitted within the same scope or file, ensuring that memory is allocated only once for the variable.

Summary & Key Takeaways

  • The video discusses the auto and extern modifiers in C programming, highlighting their usage and differences. Auto variables are automatically destroyed after their scope ends, which optimizes memory usage. The 'auto' keyword is often redundant as variables are auto by default.

  • Extern modifier allows a variable to be declared without definition, enabling access across multiple files. This is useful in projects with multiple files where variables need to be shared. Extern declarations do not allocate memory, unlike definitions.

  • Multiple declarations of extern variables are permissible, but definitions must be unique within a scope. The linker plays a crucial role in resolving references to extern variables across files. When initialized, an extern variable is considered defined, and memory is allocated.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from Neso Academy 📚

String Slicing in Python (Part 1) thumbnail
String Slicing in Python (Part 1)
Neso Academy
Classful Addressing (Part 2) thumbnail
Classful Addressing (Part 2)
Neso Academy
Process Control Block thumbnail
Process Control Block
Neso Academy
Statements in Python (Part 2) thumbnail
Statements in Python (Part 2)
Neso Academy
The Infinite while Loop in Python thumbnail
The Infinite while Loop in Python
Neso Academy
Logical AND with Conditionals in Python thumbnail
Logical AND with Conditionals in Python
Neso Academy

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.