diff --git a/comments.txt b/comments.txt index 6fbcd7f..3bc527f 100644 --- a/comments.txt +++ b/comments.txt @@ -1 +1,5 @@ @Fawzan : I'm carazy. :D + +@Avindu : I'm Late. :( + +@Avindu : Finished the Lab 01 diff --git a/contributers.txt b/contributers.txt index cf197aa..e00dbc4 100644 --- a/contributers.txt +++ b/contributers.txt @@ -1 +1,2 @@ -Mohammed Fawzan, The Architect \ No newline at end of file +Mohammed Fawzan, The Architect +E/12/117 : Hendawitharana, A.D. \ No newline at end of file diff --git a/corrupt.c b/corrupt.c index 44618d7..1af0d2a 100644 --- a/corrupt.c +++ b/corrupt.c @@ -15,8 +15,10 @@ int main(){ int i; - char string[42] = "Brace your self, CO328 project is coming!!"; + // Required enough space for the string to store + char string[43] = "Brace your self, CO328 project is coming!!"; int j; + //printf("%s", string); return 0; } diff --git a/min.c b/min.c index e24e74d..02f0f0f 100644 --- a/min.c +++ b/min.c @@ -8,13 +8,18 @@ * @param int* A pointeer to an integer array * @param int n number of elements in the array */ +#define MAXINT 100000000 int getMin(int *Array, int n) { //this is a useless comment int currmin = MAXINT; for (int i=0; i currmin) + /*Done the mistake here + * Array[i] > currmin has been corrected to + * Array[i] < currmin + */ + if (Array[i] < currmin) currmin = Array[i]; return currmin; diff --git a/numbers.c b/numbers.c index 9d42c01..95a807d 100644 --- a/numbers.c +++ b/numbers.c @@ -11,8 +11,12 @@ int main(){ int x; - for(x=43; x<12423; x++); - printf('x = %d \n', x); - + for(x=43; x<12423; x++){ + /* This is the place where mistake was. + * You must use "" for string inside printf and scanf + * not '' s + */ + printf("x = %d \n", x); + } return 0; } diff --git a/theta.c b/theta.c index d5cd68b..c05b3cf 100644 --- a/theta.c +++ b/theta.c @@ -14,6 +14,7 @@ char * giveMeSomeMemory ( int size ){ char * str ; if (size > 0) str =( char *) malloc ( size ); + str =( char *) malloc ( sizeof(char)* size ); if (size == 1) return NULL ; return ( str );