## Page 1 of 3 Include all your answers to a single word document

Page 1 of 3

and upload it to link given in the courseweb before the allocated practical hours are finished.

We Will Write a Custom Essay Specifically
For You For Only \$13.90/page!

order now

01. Write a program for the following problem. Hint: you may need set of pointers declared.

Pseudocode for the main function.
Begin
Read two integer values from a user, num1 and num2
Print the values read from the user
swap(num1,num2)
Print num1 and num2

Pseudocode for the function swap.
Declare the function to be a void
Begin swap function
Get num1 and num2 as inputs
Swap num1 and num2
End funciton

02. Comment the operation/purpose of each line in the programs given. Write the output of
each program.

Program 01:

#include
int main (void)
{
int count = 10, x;
int *int_pointer;
int_pointer = &count;
x = *int_pointer;
printf (“count = %i, x = %i
“, count, x);
return 0;
}

EC1441 – Engineering Programming
Department of Electrical and Computer Engineering
Faculty of Engineering
B.Sc. Eng. (Hons) / B.Eng. (Hons) in Engineering– Year 1 Semester 2

Laboratory Experiment 04

Page 2 of 3

Program 02:

#include
int main (void)
{
int i1, i2;
int *p1, *p2;
i1 = 5;
p1 = &i1;
i2 = *p1 / 2 + 10;
p2 = p1;
printf (“i1 = %i, i2 = %i, *p1 = %i, *p2 = %i
“, i1, i2, *p1, *p2);
return 0;
}

Program 03:

#include
int strToInt (const char string)
{
int i, intValue, result = 0;
for ( i = 0; stringi >= ‘0’ && stringi month = 9;
datePtr->day = 25;
datePtr->year = 2004;
printf (“Today’s date is %i/%i/%.2i.
“,
datePtr->month, datePtr->day, datePtr->year % 100);

return 0;
}

x Hi!
I'm Delia!

Would you like to get a custom essay? How about receiving a customized one?

Check it out