Write code for atoi(x) where x is hexadecimal string.

Answer Posted / audrius

long l = strtol(string, NULL, 16);
//or, if you need unsigned (which you usually do with hexes)
unsigned long ul = strtoul(string, NULL, 16);

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to print factorial of given number using recursion?

607


Can stdout be forced to print somewhere other than the screen?

627


What is exit() function?

565


How do you construct an increment statement or decrement statement in C?

747


What are the primitive data types in c?

580






What is function and its example?

632


Is the exit() function same as the return statement? Explain.

668


How can I find the modification date and time of a file?

607


How can I discover how many arguments a function was actually called with?

637


Explain union.

641


How can I call a function with an argument list built up at run time?

646


How is a pointer variable declared?

597


Why enum is used in c?

531


Do variables need to be initialized?

623


What is a pointer and how it is initialized?

613