About 778,000 results
Open links in new tab
  1. How do I make an array empty in C? - Stack Overflow

    Apr 19, 2017 · An initializer in form of { }; is invalid C. Note: If you meant "How do I make the contents of an array empty in C?", well, in that case, assuming "empty" translates to a value of 0, we can use …

  2. How to Initialize Array to 0 in C? - GeeksforGeeks

    Jun 17, 2024 · Initializing an array to zero is a common practice in programming to ensure that all elements start with a known value. In C, there are several ways to initialize an array to zero.

  3. How to Initialize an Array to 0 in C - Delft Stack

    Mar 12, 2025 · This tutorial introduces different ways to initialize an array to 0 in C. Learn various methods such as static initialization, loops, memset, and compound literals to effectively set array …

  4. Array initialization - cppreference.net

    Oct 16, 2022 · Arrays of known size and arrays of unknown size may be initialized , but not VLAs (since C99) (until C23) . A VLA can only be empty-initialized. (since C23) All array elements that are not …

  5. 5 Fast Methods to Initialize Array Values in C (With Examples)

    Nov 6, 2024 · Learn 5 efficient techniques to initialize arrays in C with practical code examples and performance comparisons for better programming.

  6. Initialize an Array in C - DigitalOcean

    Aug 3, 2022 · This initializes an array of size 5, with the elements {1, 2, 3, 4, 5} in order. This means that arr[0] = 1, arr[1] = 2, and so on. We don’t need to initialize all ...

  7. Efficient C Array Initialization: Methods and Examples

    Jul 22, 2025 · Explore effective techniques for initializing arrays in C and C++. Learn about direct initialization, designated initializers, macros, loops, and C++ specific solutions.

  8. How to Initialize Arrays in C: Best Practices and Zero ...

    Learn how to properly initialize arrays in C to avoid undefined behavior and bugs. This guide covers static initialization, memset, loops, and multidimensional arrays with clear examples and best practices.