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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:38:39+00:00 2026-05-25T12:38:39+00:00

I am new to C programming, and have a question about the following couple

  • 0

I am new to C programming, and have a question about the following couple lines of code. This takes place within the context of a creating a linked list of struct film:

struct film {
    char title[TSIZE];
    int rating;
    struct film * next;
}

int main(void)
{
    struct film * head = NULL;
    struct film * prev, *current;
    char input[TSIZE]; 

    // some code ommitted

    strcopy(current->title, input);

    puts("Enter your rating <0-10>");

    scanf("%d", &current->rating);
}

Basically my question is about the strcopy() and scanf() functions. I notice that with strcopy the first parameter is using the member access operator -> on a pointer to the struct. I believe that the first argument to strcopy is supposed to be a pointer to char, so when using the member access operator, are we getting a direct pointer to title even though title is not declared as a pointer inside the struct?

I am confused about how this contrasts with the scanf() call where we use the & operator to get the address of current->rating. Is scanf() taking the address of the struct pointer then doing member access or is it the address of the structs member ‘rating’? Why not just pass in the pointer similarly to strcopy()?

Id imagine there is a difference between doing &current->rating vs &(current->rating)? Is &current->rating the address of a pointer (kind of like a pointer to pointer?).

Thanks in advance.

  • 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-25T12:38:39+00:00Added an answer on May 25, 2026 at 12:38 pm

    When you pass an array as a function argument in C, the compiler actually passes a pointer to the first element in the array. arrayVar is the same as &arrayVar[0]. So, the strcopy function’s first argument is a pointer to the first element of the character array title in the structure pointed to by current.

    When you pass an int to a function, you are simply passing the value of the variable, not a pointer to it. Since scanf requires a pointer that it will store the value in, you have to use & to get a pointer to the variable instead. The second argument to scanf is a pointer to the integer rating in the structure pointed to by current.

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

Sidebar

Related Questions

This question might be naive as I'm new to ColdFusion programming. I have a
I am new to programming and I have a question about how to pull
I fairly new to programming for the Android platform and have some question about
I am quite new to programming, i have a question please help me. (
I'm new to multithreaded programming, and have a question. How do I get each
I'm new to c sharp and programming generally. I have a quick question -
i am new kernel programming.i have been trying to load this driver program for
I'm new to PHP programming and have poor knowledge about it, but I want
I am new to both Haskell and programming. My question about binding in pattern-matched,
hi i have a question about the silverlight/xna template for wp7 programming. i start

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.