diff --git a/Question 1 b/Question 1 new file mode 100644 index 00000000..d26c2563 --- /dev/null +++ b/Question 1 @@ -0,0 +1,14 @@ +#include d +int x=1; +main() +{ + + if(x==1) +printf("x equals 1"); + else +{ + printf("x does not equal 1"); +} + return 0; +} + diff --git a/Question 2 b/Question 2 new file mode 100644 index 00000000..c7fd00a3 --- /dev/null +++ b/Question 2 @@ -0,0 +1,21 @@ +2a float do_it(char A, char B, char C) + +2b void print_a_number(int a) + +2c #include + void print_msg( void ); + main(){ + print_msg("This is a message to print"); + return 0; + } + void print_msq( void ) + { + puts("This is a message to print"); + return 0; + } + +/*The function name in the header file is different from that in the program body that is; print_msg and print_msq are different yet they +are supposed to be the same in a given program.*/ + +/*The function has arguments yet the declaration indicates that the function has no arguments.*/ + diff --git a/Question 3 b/Question 3 new file mode 100644 index 00000000..285e197a --- /dev/null +++ b/Question 3 @@ -0,0 +1,20 @@ +3a long a[50]; + +3b a[49]=123.456 + +3c The values of x; 0 to 99 + +3d The values of ctr are; 2,5,8 + +3e + int i=1; + while(i<100) +{ + printf("%d\n",i); + i+=3; +} + + +3f for (counter = 1; counter < MAXVALUES; counter++ );/*The for statement is not supposed to be terminated in C*/ + printf("\nCounter = %d", counter); + diff --git a/Question 4 b/Question 4 new file mode 100644 index 00000000..642adba2 --- /dev/null +++ b/Question 4 @@ -0,0 +1,52 @@ +4a +/*void addarrays(int N, int x[],int y[],int z[]){ +int i; +for(i=0; i +#include +int N, i; +int *addarrays(int N,int x[],int y[],int z[]){ +int i; +for(i=0; i