C challenge: Hmmm...Real Challenging:)

This is a discussion on C challenge: Hmmm...Real Challenging:) within the C Programming forums, part of the General Programming Boards category; Hi Folks, Is there any way out to know the sizeof any DataTYPE without using "sizeof" operator. My requirement is ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    36

    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.

    Code:
    #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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    You've asked already - Getting the sizeof DATA TYPES without using "sizeof" operator
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 09: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 Cprogramming.com
    Replies: 44
    Last Post: 03-23-2002, 03:38 PM
  5. Replies: 7
    Last Post: 12-12-2001, 09:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21