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

The Archive Base Latest Questions

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

From the lectures notes of a course at university, on call-by-value: void fun(int *ip)

  • 0

From the lectures notes of a course at university, on “call-by-value”:

void fun(int *ip)

{

*ip =100;

}

called by

int n=2;  

int *np;

np = &n; 

fun(np);

would change the value of n to 100.

When we say “int *ip”, what exactly do we mean? A pointer of type integer? If so, when we call fun() with np as its argument, shouldn’t there be an error as np has the address of n, which is not an integer?

And then, we change the value of ip to 100, so doesn’t that mean that n now has the value that’s in the “memory slot” with the address 100? I am sure I am missing something. 🙂

  • 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:56:42+00:00Added an answer on May 13, 2026 at 10:56 am

    A pointer of type integer?

    No, a pointer to an integer.

    when we call fun() with np as its argument, shouldn’t there be an error as np has the address of n, which is not an integer?

    n is an integer so there’s no problem. &n, np and ip all have the same type in your code: int*.

    And then, we change the value of ip to 100

    No … we change the value of *ip, not of ip. That is, we change the value that ip points to (which is also sometimes called the pointee).

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

Sidebar

Related Questions

The code is from K. Pollari-Malmi's lecture notes for the course Introduction to Programming:
What is an actual name of instance variable, say, topSpeed, as from lectures of
I recently started following the online course on iPhone development from Stanford University on
I'm attending the course of IOS development on itunesU (from Stanford University). And i
I'm watching a video course/lectures from Stanford. The course is The Structure and Interpretation
I recently started following the online course on iPhone development from Stanford University on
I'm watching some great lectures from David Malan ( here ) that is going
The socket server listed in step 3 from http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html builds cleanly (java version 1.7.0_02)
I recently started out with iOS programming (with the Stanford CS193P lectures from iTunes
I'm working on the Breakout assignment from the Stanford lectures on iTunes U (still

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.