Write your own atoi ( ) |
#include <bits/stdc++.h> NEW_LINE using namespace std ; int main ( ) { int val ; char strn1 [ ] = "12546" ; val = atoi ( strn1 ) ; cout << " String ▁ value ▁ = ▁ " << strn1 << endl ; cout << " Integer ▁ value ▁ = ▁ " << val << endl ; char strn2 [ ] = " GeeksforGeeks " ; val = atoi ( strn2 ) ; cout << " String ▁ value ▁ = ▁ " << strn2 << endl ; cout << " Integer ▁ value ▁ = ▁ " << val << endl ; return ( 0 ) ; }