Thread: C references

  1. #1
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717

    C references

    When you call &variable in C, it's the same as C++, and returns the location of the variable, instead of the variable itself, right?
    and in my case scanf("%f", &wages);
    Or am I totally off now? xD
    thanks in advance!
    Currently research OpenGL

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Yep yep!

  3. #3
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    Yes, &variable is the address of a variable.

    scanf expects a pointer, which is an address, so

    Code:
    scanf("%f", &wages);
    stores the value at the address of wages.
    OS: Linux Mint 13(Maya) LTS 64 bit.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler settings, references etc...
    By ejohns85 in forum C++ Programming
    Replies: 0
    Last Post: 05-14-2009, 04:53 AM
  2. VC++ 2005 Express: missing references page
    By psychopath in forum Tech Board
    Replies: 1
    Last Post: 08-21-2006, 04:55 PM
  3. Vector of references
    By roktsyntst in forum C++ Programming
    Replies: 5
    Last Post: 04-15-2003, 06:40 PM
  4. declare references to references works!
    By ManuelH in forum C++ Programming
    Replies: 4
    Last Post: 01-20-2003, 08:14 AM
  5. Pointers and references...
    By SushiFugu in forum C++ Programming
    Replies: 6
    Last Post: 12-08-2001, 04:21 PM

Tags for this Thread