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 8828091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:31:41+00:00 2026-06-14T07:31:41+00:00

Consider: NSString*test2=[[NSString alloc]init]; test2=@yo; NSString *test= test2; NSLog(@test: %@ test2: %@,test, test2); test2=@what the?;

  • 0

Consider:

  NSString*test2=[[NSString alloc]init];

test2=@"yo";
NSString *test= test2;
NSLog(@"test: %@ test2: %@",test, test2);
test2=@"what the?";
NSLog(@"test: %@ test2: %@",test, test2);

Output:

2012-11-14 09:50:26.720 testt[693:c07] test: yo test2: yo
2012-11-14 09:50:26.721 testt[693:c07] test: yo test2: what the?

How does one make test a true pointer, such that when test2 changes, so does test?

  • 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-14T07:31:42+00:00Added an answer on June 14, 2026 at 7:31 am

    NSString *test2 is already a pointer. You’d want to make test pointer to a pointer (double *), and assign test2‘s address to it using & prefix then access the value using * prefix. I suck at explaining this so here is the code:

    test2=@"yo";
    NSString **test= &test2;
    NSLog(@"test: %@ test2: %@", *test, test2);
    test2=@"what the?";
    NSLog(@"test: %@ test2: %@", *test, test2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following statement: for (NSString *string in anArray) { NSLog(@%@, string); } How
Please consider this code: NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:[ NSURL URLWithString:url ]]; //
Consider the following: - (id)initWithTitle:(NSString *)newTitle boxOfficeGross:(NSNumber *)newBoxOfficeGross summary:(NSString *)newSummary; What does this mean?
I have 2 new questions: 1) Consider this line: NSString *myString = [[NSString alloc]
Consider the following code NSString *param_string @1:3:6:10:15:22:28:30; NSArray *params = [param_string componentsSeparatedByString:@:]; NSNumberFormatter *formatter
Consider this: NSString *whatever=[NSString stringWithFormat:@My float: %.2f,aFloat]; This will round my aFloat to 2
Consider this: string test = ""; somestring.ToList().Take(50).Select( delegate(char x) { test += x; return
Please consider the following code: NSString *string = @ä; const char *str1 = [string
Consider the following two code samples: NSData *imgData = UIImagePNGRepresentation(imgFull); NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
Consider the 2 following methods of reading a string from a file: NSString *path

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.