Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 849809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:09:42+00:00 2026-05-15T07:09:42+00:00

I create an array, similar to classic C (not NSArray or one of it’s

  • 0

I create an array, similar to classic C (not NSArray or one of it’s children) – something like BOOL i[5];. And I want to make all its values to be equal to NO.

First of all, I didn’t found any information about initial values of such arrays (I know that in classic C they will be undefined, but don’t know exactly about Objective-C. I found info about classes and its inner data [after allocation, without initialization], but not about simple data types).

And the second, if I should set array values manually – should I use memset(...); or something different?

To prevent possible questions… I want to use this construction as array of temporary boolean flags and don’t think that it is proved to use something like NSArray here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:09:42+00:00Added an answer on May 15, 2026 at 7:09 am

    If that BOOL i[5] is an ivar of an ObjC class, its content will be initialized (memset-ed) to 0.

    As described in the +alloc method:

    … memory for all other instance variables is set to 0.


    To set the array to all NO in other situations, you could use

    memset(i, 0, sizeof(i));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know you can create an array like this: $a = array(); and append
I'm try to create a query which will search four different tables with one
Ok, I've checked the other questions similar to this one, and none seem to
Given an enum similar to this: Friend Enum TestValue As Int32 tstNotSet = -1
I already asked similar question here, but I still get some errors, so I
I have to create a program that displays the 9 rows of a sudoku
Hey, I'm currently trying to extract information from a 3d array, where each entry
Is using the PrintServer and PrintQueue classes the same as looking at the jobs
I'm especially interested of windows, mingw. Thanks. Update: First, I thought everyone is familiar
I have a problem when setting a variable inside a Java class Here is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.