Thread: C challenge: Hmmm...Real Challenging:)

  1. #1
    Registered User
    Join Date
    Oct 2007

    C challenge: Hmmm...Real Challenging:)

    Hi Folks,

    Is there any way out to know the sizeof any DataTYPE without using "sizeof" operator.

    My requirement is very simple.

    #include <stdio.h>
    int ReturnSize( // the Data Type argument to be passed, may be CHAR, INT, FLOAT, DOUBLE or even STRUCTURE)
           // Calculates the sizeof the argument WITHOUT using "SIZEOF" operator and returns the size
    int main()
          int size;
          size = ReturnSize( // Can be CHAR/INT/FLOAT/DOUBLE/STRUCTURE);

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You've asked already -
    Please read the rules about not asking the same thing over and over.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Factorial
    By foxman in forum Contests Board
    Replies: 27
    Last Post: 07-11-2008, 06:59 PM
  2. %16 with double
    By spank in forum C Programming
    Replies: 11
    Last Post: 03-05-2006, 10:10 PM
  3. Requesting a challenge
    By RealityFusion in forum C++ Programming
    Replies: 8
    Last Post: 08-18-2003, 08:24 PM
  4. Programming Puns
    By kermi3 in forum A Brief History of
    Replies: 44
    Last Post: 03-23-2002, 04:38 PM
  5. Replies: 7
    Last Post: 12-12-2001, 10:28 AM