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

  • Home
  • SEARCH
  • 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 8526471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:16:54+00:00 2026-06-11T08:16:54+00:00

I am new to Objective C and doing some practice with objects. While something

  • 0

I am new to Objective C and doing some practice with objects. While something like Fraction* f = [[Fraction alloc] init ]; works, whenever I try to do Fraction c; I get Interface type cannot be statically allocated Is there anyway to allocate objects on the stack (like in c++) ? or am I trying the wrong thing ?

  • 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-06-11T08:16:56+00:00Added an answer on June 11, 2026 at 8:16 am

    You cannot allocate an object statically in Objective C. There are a lot of reasons for this. Including the fact that objects should be initialized but initialization methods are allowed to change the address of the object.

    In C++ a constructor must initialize the object it’s called upon and cannot, in any way, change the object address. This is not true in Objective C. The equivalent of constructors (the alloc+init* sequence or a class level method) are allowed to decide that they are going to change the address of the object they are called upon (they will take care of freeing the original object, of course).

    There’s no way for them to free the statically allocated memory nor to change the address of your stack, of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to objective-C. I want to use NSMutableArray to store some objects i
Currently, my Objective C classes use C++ objects by doing a new when the
I'm relatively new to Objective C and while I've been trucking right along writing
I am new to objective-c and i cannot figure out how memory handling works
I just recently made the move to Objective-C. I am doing some exercises from
I am currently learning cocos2D-x and am doing some sprite animation. My Objective is
Ok, I am new to Objective-C/iPhone programming, so there are some questions arising when
I'm still very new to Objective C, and I was wondering something regarding viewDidDisappear.
I am making a new Objective C class and it gave two options as
I am new to iOS development. I've recently stumbled upon the new objective-c collection-literals

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.