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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:49:34+00:00 2026-05-29T08:49:34+00:00

I have this declaration in my header: – (char*) randomCharGenerator; And the method itself:

  • 0

I have this declaration in my header:

- (char*) randomCharGenerator;

And the method itself:

- (char*) randomCharGenerator {
    char *letter;
    return letter;
}

From what I read on the tutorial on CocoaDevCentral (http://cocoadevcentral.com/d/learn_objectivec/), I’m trying to call it like this:

char *tempLetter;
tempLetter = [char randomCharGenerator];

But I get the error: “Expected expression.” What am I doing wrong?

  • 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-29T08:49:35+00:00Added an answer on May 29, 2026 at 8:49 am

    Where you have

    tempLetter = [char randomCharGenerator];
    

    you need to replace char with an instance of the class for which you defined the randomCharGenerater method.

    This is because in this declaration:

    - (char*) randomCharGenerator;
    

    The - at the beginning denotes that randomCharGenerator is an instance method of whatever class it’s in, so it needs to be sent to an instance of your class. If you had replaced the - with a +, you would want to send the randomCharGenerator message to the class, as opposed to an instance of your class.

    Note that char is a C data type, not an Objective-C class or object, so you can’t send it messages. So no expression of the form [char foo] is syntactically correct.

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

Sidebar

Related Questions

This is for C++. Usually we have our function declaration in header file and
I have this before the interface declaration in my MainView.h header. typedef enum {
In my header, I have a prototype declaration like this: void move(int, int); I
I would like to have declaration like this: void Date::get_days_name(const Date& = this) which
It seems I can't easily have an XSD declaration for this simple XML <root>
there is something I try to understand. I have this object declaration in my
I have A header file which contains declaration of a function, let's call it
I have 3 header files in the project: Form1.h - this is header with
I have a header file that looks like header.h int TOS; This file is
I have this line in the declarations section: Private filePath As String And something

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.