User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:stdlib.h:atoi

Table of Contents

atoi

    #include <stdlib.h>
    int atoi(const char *str);

convert a string to integer

C Sourcecode Example

#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <stdlib.h>
 
int main(void){
 
    char string[]="1234";
    int  i;
 
printf("string = %s \n", string );
printf("int = %i \n", atoi(string) );
 
i = atoi(string);
i = i + i;
printf("i + i = %i\n", i);
 
return 0;
}

Output

  Output:
  user@host:~$ ./atoi 
  string = 1234 
  int = 1234 
  i + i = 2468
advertising
c/stdlib.h/atoi.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum Datenschutz