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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:22:00+00:00 2026-05-13T10:22:00+00:00

Came across this example in the book im reading and it didn’t make sense

  • 0

Came across this example in the book im reading and it didn’t make sense at all to me, I’m probably missing something but it seems like youre assigning count with the values ’10’ and then the value ‘x’ which isnt even an int. Just wondering if this is a syntax that is valid.

The book says this:

The variables count and x are declared to be integer variables in the normal fashion. On the next line, the variable intPtr is declared to be of type “pointer to int.” Note that the two lines of declarations could have been combined into a single line:

int count = 10, x, *intPtr;

here’s the program its taken from:

#import <Foundation/Foundation.h>
int main (int argc, char *argv[ ])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    int count = 10, x;

    int *intPtr;

    intPtr = &count;

    x = *intPtr;

    NSLog (@"count = %i, x = %i", count, x);

    [pool drain];

    return 0;

}
  • 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-13T10:22:01+00:00Added an answer on May 13, 2026 at 10:22 am

    This is just a declaration. Declaration consists of the initial part (declaration specifier) that describes the “basic” part of the type, and a comma-separated sequence of declarators, each of which declares a separate name and, possibly, modifies the basic type. In C you can declare multiple names using the same declaration specifier

    int count, x, *intptr;
    

    is equivalent to

    int count;
    int x;
    int *intptr;
    

    Optionally, you can add an initializer to each declarator or to some fo them. So

    int count = 10, x, *intptr;
    

    is the same as

    int count = 10;
    int x;
    int *intptr;
    

    That’s all there’s to it.

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

Sidebar

Related Questions

So I was reading Kyle's book and came across this example he has used
While I was reading Oracle Swing documentation, I came across this example of a
I'm reading Effective C++ and came across this example: class Window { // base
I came across this example in Head First Design Patterns book. Pizza class has
I was reading through K&R and i came across this example about uncertainty in
I'm learning Python from a book and came across this example: >>> '%f, %.2f,
I'm learning Python from a book, and I came across this example: M =
I'm reading through some code for an Arduino example and I came across this
A bit of a neophyte haskell question, but I came across this example in
I was reading Eloquent JavaScript and I came across this example for the puzzle:

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.