Update 1st June 26
This commit is contained in:
Executable
BIN
Binary file not shown.
@@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
typedef unsigned char BYTE;
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
FILE *src = fopen(argv[1], "rb");
|
||||||
|
FILE *dst = fopen(argv[2], "wb");
|
||||||
|
|
||||||
|
BYTE b;
|
||||||
|
|
||||||
|
while (fread(&b, sizeof(b), 1, src) != 0)
|
||||||
|
{
|
||||||
|
fwrite(&b, sizeof(b), 1, dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(dst);
|
||||||
|
fclose(src);
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Hayet, 77666327
|
||||||
|
Munna, 59950786
|
||||||
|
Executable
BIN
Binary file not shown.
@@ -0,0 +1,20 @@
|
|||||||
|
#include <cs50.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// FILE here calls FILE function from stdio.h & "a" using for apend.
|
||||||
|
FILE *file = fopen("phonebook.csv", "a");
|
||||||
|
if (file == NULL)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
char *name = get_string("Name: ");
|
||||||
|
char *number = get_string("Number: ");
|
||||||
|
|
||||||
|
fprintf(file, "%s, %s\n", name, number);
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Hayet, 77666327
|
||||||
|
Munna, 59950786
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
|
||||||
|
{
|
||||||
|
int n = 50;
|
||||||
|
int *p = &n;
|
||||||
|
printf("%p\n", p);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
const iunt capacity = 50;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
person people[CAPACITY]
|
||||||
|
int size;
|
||||||
|
} stack;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int scores[1024];
|
||||||
|
for (int i =0; i < 1024; i++)
|
||||||
|
{
|
||||||
|
printf("%i\n", scores[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Submodule
+1
Submodule isiah/learning-area added at 31b3ff0a62
@@ -0,0 +1,17 @@
|
|||||||
|
// Demonstrates memory error via valgrind
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int *x = malloc(3 * sizeof(int));
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
x[0] = 72;
|
||||||
|
x[1] = 73;
|
||||||
|
x[2] = 33;
|
||||||
|
free(x);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user