Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion comments.txt
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
@Fawzan : I'm carazy. :D
E/11/209


1. In the min.c program, variable MAXINT did not declared and did not initialized, For that i just removed that and assign Array's 0th element as currmin.
And also, comparision logic was wrong. If the Array[i] less than currmin then only currmin will be updated by Array[i] value.

2. In the corrupt.c program, integers i,j did not initialized and used. And also when we run the code, there is an additional @ sign comes in.
Don't know why. So i just increase the char array's length by 1.

3. In numbers.c program, Double quotetions has to be used for String.

4. In theta.c program, NULL is the keyword. We can use none of the KEY WORDS to declar variables, class name, functions etc.
3 changes: 2 additions & 1 deletion contributers.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Mohammed Fawzan, The Architect
Mohammed Fawzan, The Architect
Keerththanan, Undergraduate.
16 changes: 16 additions & 0 deletions corrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* You need a clue?
* In the hitch hikers guide to the Galaxy, 42: The answer to life, the universe and everything
*/


/**
int main(){


Expand All @@ -20,3 +23,16 @@ int main(){

return 0;
}
*/

int main(){
int i = 0;
char string[43] = "Brace your self, CO328 project is coming!!";
int j = 0;

printf("%d %s %d \n", i, string, j);
return 0;
}

//String length has been initialized.
//Integers did not initialized and used
26 changes: 24 additions & 2 deletions min.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <stdio.h>

/**
* Author : Mohammed Fawzan
* Problem : If Then Else
Expand All @@ -8,9 +10,10 @@
* @param int* A pointeer to an integer array
* @param int n number of elements in the array
*/
int getMin(int *Array, int n) {

//this is a useless comment
/**
int getMin(int *Array, int n) {

int currmin = MAXINT;

for (int i=0; i<n; i++)
Expand All @@ -19,6 +22,25 @@ int getMin(int *Array, int n) {
return currmin;

}
*/


int getMin(int *Array, int n){
int currmin = Array[0];

for (int i = 1; i < n; i++){
if (Array[i] < currmin)
currmin = Array[i];
}

return currmin;
}

int main(){
int array[] = {490,518,987,787,1000, 587, 897, 654, 125};
int length = sizeof(array)/sizeof(int);
printf("%d \n", getMin(array,length));

return 0;

}
15 changes: 14 additions & 1 deletion numbers.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#include <stdio.h>

/**
* Author : Mohammed Fawzan
* Problem : Point of Origin
*/
#include <stdio.h>

/**
* I want to print some numbers
* Can U fxi mE?
*/

/**
int main(){

int x;
Expand All @@ -16,3 +19,13 @@ int main(){

return 0;
}
*/

int main(){

int x;
for(x = 43; x < 12423; x++);
printf("x = %d \n", x);

return 0;
}
22 changes: 15 additions & 7 deletions theta.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <stdio.h>
#include <stdlib.h>

/**
* Author : Mohammed Fawzan
* Problem : Guilty
Expand All @@ -8,13 +11,18 @@
* Am I making a mistake? You tell me.
*/

//#define NULL 0
//NULL is Null, Can't use KEYWORDS for decleration.
char *giveMeSomeMemory(int size){
char *str ;
if (size == 0)
return NULL ;
if (size > 0)
str =(char *) malloc(size);

return str;
}

char * giveMeSomeMemory ( int size ){
char * str ;
if (size > 0)
str =( char *) malloc ( size );
if (size == 1)
return NULL ;
return ( str );
int main(){
printf("%d \n",giveMeSomeMemory(1));
}