Skip to content

Commit 8d31d8f

Browse files
Add files via upload
1 parent e333f41 commit 8d31d8f

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

C/Example/Array Manipulation.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
const int arraySize = 5;
6+
int numbers[arraySize] = {1, 2, 3, 4, 5};
7+
8+
for (int i = 0; i < arraySize; i++)
9+
{
10+
printf("%d ", numbers[i]);
11+
}
12+
13+
return 0;
14+
}

C/Example/File Handling.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
FILE *file = fopen("example.txt", "w");
6+
if (file != NULL)
7+
{
8+
const char data[] = "This is a file handling example.";
9+
if (fprintf(file, "%s", data) < 0)
10+
{
11+
fclose(file);
12+
return 1; // Error handling for fprintf
13+
}
14+
fclose(file);
15+
}
16+
else
17+
{
18+
return 1; // Error handling for file opening
19+
}
20+
return 0;
21+
}

C/Example/hello world.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
const char message[] = "Hello, World!\n";
6+
if (printf("%s", message) < 0)
7+
{
8+
return 1; // Error handling for printf
9+
}
10+
return 0;
11+
}

0 commit comments

Comments
 (0)