File tree 3 files changed +39
-1
lines changed
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1
- # Codeforwin-C- programming
1
+ # Codeforwin C programming
2
2
Codeforwin is a platform for learning, practicing and sharing coding skills.
3
+
4
+ A blog about computer science, for computer science learner – by computer science lover.
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @author Pankaj Prakash
3
+ * @website http://codeforwin.org/
4
+ * @lastmodified 11:35 AM, January 5, 2018
5
+ * @description C programt to convert string to integer using atoi library function.
6
+ *
7
+ * Syntax - int atoi (const char * str);
8
+ * ------------------------------------------------------------------------------------- */
9
+
10
+ #include <stdio.h>
11
+ #include <stdlib.h> // Used for atoi()
12
+
13
+ #define INTEGER_SIZE 20 // Maximum size of integer in string representation
14
+
15
+
16
+ int main ()
17
+ {
18
+ char number [20 ];
19
+ int num ;
20
+
21
+
22
+ /* Input string representation of integer from user. */
23
+ printf ("Enter any integer: " );
24
+ gets (number );
25
+
26
+
27
+ /* Convert string representation of number to integer */
28
+ num = atoi (number );
29
+
30
+
31
+ /* Print converted integer */
32
+ printf ("Converted integer = %d\n" , num );
33
+
34
+
35
+ return 0 ;
36
+ }
You can’t perform that action at this time.
0 commit comments