Thread: quick question about sizeof operator

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    552

    quick question about sizeof operator

    Is sizeof similar to a function in that it is 'called' each time I place it in my code (meaning will any calculations take place at every sizeof), or will some sort of constant be placed in the code instead?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Because sizeof is not a function but instead a compile time operator the answer to your question is that the compiler will replace the sizeof with a constant.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie question about 'sizeof' and arrays
    By Sharke in forum C Programming
    Replies: 27
    Last Post: 12-09-2009, 06:30 AM
  2. Quick Sizeof Question
    By PetrolMan in forum C++ Programming
    Replies: 4
    Last Post: 03-30-2009, 12:30 AM
  3. malloc and sizeof question
    By cus in forum C Programming
    Replies: 4
    Last Post: 01-03-2009, 12:23 PM
  4. Quick question about types...
    By Elysia in forum C++ Programming
    Replies: 32
    Last Post: 12-07-2008, 05:39 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM