both signed and unsigned, by printing appropriate values from standard headers and by direct computation?
thanks for your help :)
In C, how do i write a program to determine the ranges of char, short, int and long variables...?
The best way would be to directly enter the specific bits for the min and max values. Unsigned are easy, for example, for a 4-byte unsigned int, 0x0 is the minimum and 0xFFFF is the maximum. The signed will be a little trickier, since you will need to figure out the 2's complement, which would be 0x8000 for the minimum and 0x7FFF for the maximum, I believe.
Reply:Hi Friend,
You can use sizeof operator.....
- nirav soni
Reply:i couldn't understand what you are trying to do
but from what i understand you are trying to find the max,min value of types , right?
Anyway i will give you the ideas for doing this as i dont like to take the fun from you :) (I believe if you got a hint and you seek for it , you wont forget it)
To do this you need:
1- Setting vars with a way to get the input from and to it
2- Use if-statement/switch (else if or any others) to get the variable type
3- After that use printf to disable your output , using some things like if from step 2 == Double then its max value going to be somethings with x 10^n
anyway you got the idea
if you still need help feel free to contact me :)
──────────────────────────
........................┌──────┐.........
........................│...BEST...│.....
╔════════════════════════╗
║▒██████████████████████▒║
║▒▒[][Myspace░░░░░░░Proxies][]▒▒║
║▒██████████████████████▒║
║▒►....... https://eCrossX.com ....... ◄▒║ [Secure and recommended - please notice 's' in httpS]
║▒►........ https://pSector.info ......... ◄▒║ [Secure and recommended - please notice 's' in httpS]
║▒►........ http://pSector.info ............◄▒║
║▒░░░░░░░░░░░░░░░░░░░░░░▒║
╚════════════════════════╝
│...........Unblockable SSL proxies..........│
└───────────────────────┘
Reply:Well i guess this method would work ok:
1.Declare the variable type.(signed /unsigned int..)
2.initialize the counter to 0 and increment it and repeatedly check whether the no. is now negative or not...ie
for (c=0;c%26gt;0;c++)
printf ("%d",c );
the logic is that c...suppose an integer ..shall attain a maximum value ie32767...and on next increment it shall become a negative value ..so computer prints the max. no. ie 32767....similarly for the negative range
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment