Professional Documents
Culture Documents
Ali Haider: To:Sir Marwat
Ali Haider: To:Sir Marwat
Sap#8611
OS LAB
TO:SIR MARWAT
Question 1
Question # 02
(1)
Error is printed on screen.
In this snippet printf function is trying to get a string for %s from variable string but it has an array
in it that is why it throughs error on compilation.
(2)
Error is printed on screen.
In this snippet printf function is trying to get a string for %s from variable string but the string
variable is not declared due to which it can not find it.
Question # 04
CODE
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main() {
int i, x, y, n, table;
x = 10, y = 2, table = 0;
n = fork();
if (n > 0)
{
printf("\nUsing Parent Process \n\n");
for (i = 1; i <= 10; i++)
{
printf("%d*%d = %d\n", x, i,(table = x * i));
}
}
else {
printf("\nUsing Child Process \n\n");
return 0;
}
}