text: Write your own atoi ( ) |
code: #include <stdio.h> NEW_LINE #include <stdlib.h> NEW_LINE #include <string.h> NEW_LINE int main ( ) { int val ; char strn1 [ ] = "12546" ; val = atoi ( strn1 ) ; printf ( " String ▁ value ▁ = ▁ % s STRNEWLINE " , strn1 ) ; printf ( " Integer ▁ value ▁ = ▁ % d STRNEWLINE " , val ) ; char strn2 [ ] = " GeeksforGeeks " ; val = atoi ( strn2 ) ; printf ( " String ▁ value ▁ = ▁ % s STRNEWLINE " , strn2 ) ; printf ( " Integer ▁ value ▁ = ▁ % d STRNEWLINE " , val ) ; return ( 0 ) ; }