aboutsummaryrefslogtreecommitdiff
path: root/simple-C-programs
diff options
context:
space:
mode:
authorHyder Hadi <hyder@hyderhadi.xyz>2026-04-18 20:00:11 +0300
committerHyder Hadi <hyder@hyderhadi.xyz>2026-04-18 20:00:11 +0300
commit781eb09f68f88b1c0de1954afafa2d81a61f653c (patch)
tree2471cb9ac45ff8aad694e80c58595ce44603366a /simple-C-programs
parent6b4e1641366f51e27eae78a2506b4b66d3e9cd4c (diff)
Trying to implement a dynamic string in C, i figured how to read characters correctly with getchar()
Diffstat (limited to 'simple-C-programs')
-rw-r--r--simple-C-programs/DynamicString.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/simple-C-programs/DynamicString.c b/simple-C-programs/DynamicString.c
new file mode 100644
index 0000000..9141dba
--- /dev/null
+++ b/simple-C-programs/DynamicString.c
@@ -0,0 +1,25 @@
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+int main() {
+
+ printf("Echo function:: Write something to ECHO: ");
+
+
+ char *Dynamic_string = NULL;
+ size_t string_length = 20;
+ Dynamic_string = malloc(string_length);
+
+ int input;
+ while((input = getchar()) != '\n' && input != EOF) {
+
+ }
+
+
+
+
+ return 0;
+} \ No newline at end of file