Sample C Program To Convert String To An Integer Using atoi() Function.


#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{

int i;
i = atoi(" 100");

printf(" The integer value is: %d ", i);
getch();

return 0;

}

OUTPUT:

The integer value is: 100



NOTE:

If you liked the post/article or if you think this post/article helped you in any way, then please show your appreciation by filling up at least one form from the options given below:

-- Click Here To Win Rewards Each Time When You Access Internet.

-- Click Here To Add The Best Online Dictionary Resources... Right To Your Browser.

-- Click Here To Instantly Check All Your Webmail Accounts... Right From Your Browser.

-- Click Here To Get Up To 40% Off On Your Favorite Books.

-- Click Here To Register In AllSchoolStuff - Helping Parents Buy School & Learning Products.

-- Click Here To Apply To Multiple Colleges With A Single Application.

-- Click Here To Register In SwarnIQ - A Social Reading Experience.

-- Click Here To Win Rewards, Cash, Shopping Vouchers & Exciting Gifts For Completing Surveys.

-- Click Here To Submit Your Resume - TimesJobs (Freshers & Experienced)

-- Click Here To Submit Your resume - Shine (Freshers & Experienced)




Comments

  1. The ? Is convert string to integer but where is the string declaration . . .

    ReplyDelete
    Replies
    1. i = atoi(" 100");

      100 which is inside quatation

      Delete
  2. The ? Is convert string to integer but where is the string declaration . . .

    ReplyDelete
    Replies
    1. anything inside double quote is string.
      so "101" is a string
      if u want to mention explicitly u can have
      char str[]="101";
      then
      i=atoi(str)

      Delete
  3. char str[100];
    str="123"
    i=atoi(str);

    will do it
    actually anything within double quotes is STRING
    atoi("101") where 101 is a string

    ReplyDelete
  4. What is atoi()?

    ReplyDelete
    Replies
    1. itz converting from an ascii value to integer value

      Delete
  5. a denotes alphabet(a) to integer(i)

    ReplyDelete

Post a Comment

Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...

Experienced guys can share their resumes at administrator@abapmadeeasy.com/admin@abaper.in

Popular Posts