c-first-steps

a C playground
Index Commits Files Refs README
commit 4ebefeb9823adc16c85cbcad2b4aafbbd9940158
parent ffc5a7dd58aab5c2180d5fe208edd42cd1327152
Author: Martin J. Klockner <martin.cachari@gmail.com>
Date:   Tue, 17 Nov 2020 01:22:54 -0300

Added guia03/ej5.c

Diffstat:
Aguia03/ej5.c | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/guia03/ej5.c b/guia03/ej5.c
@@ -0,0 +1,14 @@
+/*    Calculates the length of a string and prints it on stdout    */
+
+#include <stdio.h>
+
+int main(void) {
+
+    char s[] = "Hello world!\n";
+    int i;    
+    for(i = 0; s[i] != '\0'; i++) {
+    }
+    printf("%d\n", i);
+    
+    return 0;
+}