-
Notifications
You must be signed in to change notification settings - Fork 0
/
part1.c
85 lines (69 loc) · 2.36 KB
/
part1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* Machine Problem #1
* CS 241, Spring 2010
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "mp1-functions.h"
int main()
{
/*
* [Part 1]:
* Edit the provided part1.c file to print out the tweleve "Illinois" lines
* that are provided in the code inside mp1-functions.c.
*/
//pass 81 value to print first Illinois.
first_step(81);
// initialize a varaible with value 132 and pass its pointer as an argument.
int val = 132;
second_step(&val);
// pass a double pointer to string which has value 8942 as its value.
// int double_val = 8942;
int** pp = (int **) malloc(sizeof(int*));
*pp = (int *) malloc(sizeof(int));
*pp[0] = 8942;
double_step(pp);
free(*pp);
free(pp);
// initialize a pointer value to zero and pass it to strange_step function.
int* p_val = 0;
strange_step(p_val);
// pass a character array whose fourth value is zero.
int name[4] = {0};
empty_step(name);
// create a character array and pointer to that array.
char s[4];
char* s1;
s1 = s;
s[3] = 'u';
two_step(s, s1);
// create a character array and assign other these values.
char first[10];
char* second = first + 2;
char* third = second + 2;
three_step(first, second, third);
// use above arrays assign values in such away that they will call this.
*first = 0;
*second = *first + 4;
*third = *second + 4;
triple_step(first, second, third);
// use the above arrays to call third
//third = second = first;
first[1] = 0;
second[2] = first[1] + 8;
third[3] = second[2] + 8;
step_step_step(first, second, third);
// everything is set just call above function.
triple_three_step_step_step(first, second, third);
// create an integer which is less than 256
int b = 10;
char* a = (char* )&b;
it_may_be_odd(a, b);
// create an integer array with initial value 0;
p_val =(int *) malloc(sizeof(int));
*p_val = 513;
the_end(p_val, p_val);
free(p_val);
return 0;
}