Results 1 to 5 of 5

Thread: What does * mean in C?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2008
    Posts
    474

    What does * mean in C?

    Code:
    char *str="SONIA";
    
    }
    What does the above line means?
    char *str--I guess by using * we can store more than one character in str.
    I am right or wrong??

    Please help me!!!!

  2. #2
    Addicted Member thetimmer's Avatar
    Join Date
    Jan 2014
    Location
    Plano, Texas
    Posts
    243

    Re: What does * mean in C?

    I believe it means Pointer
    _____________
    Tim

    If anyone's answer has helped you, please show your appreciation by rating that answer.
    When you get a solution to your issue remember to mark the thread Resolved.


    reference links

  3. #3
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,170

    Re: What does * mean in C?

    In this context, char * str means a variable called str which is of type pointer to memory containing char. When used with initialization as in post #1, the chars S O N I A and the NULL char are placed in memory and str is allocated a value that is the memory address of the character S.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Member
    Join Date
    May 2014
    Posts
    44

    Re: What does * mean in C?

    Pointer * means ...
    Last edited by CrazyBoy; May 21st, 2014 at 03:59 AM.

  5. #5
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: What does * mean in C?

    Quote Originally Posted by CrazyBoy View Post
    Pointer * means that the value is not saved in the variable itself. The variable keeps number which refers to the value saved memory. It is explained here:
    That is C++ not C.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width