Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

turn a string into integer in C

// C program to demonstrate 
// the working of SSCANF() to
// convert a string into a number
  
#include <stdio.h>
int main()
{
    const char* str = "12345";
    int x;
    sscanf(str, "%d", &x);
    printf("
The value of x : %d", x);
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #turn #string #integer #C
ADD COMMENT
Topic
Name
2+3 =