Below is a sketchy outline of a C program
#include<stdio,h>
Main()
{
File *pt1, *pt2;
Int x;
Float y;
Char z;
Fpt=fopen(“sample,old”,”r”);
Fpt=fopen(“sample.new”,”w”);
……………………………………
Fclose (pt1);
Fclose (pt2);
}
Write C statements to do the following:
i. Read the values of x, y and z from the file sample.old [1 mark]
ii. Display each value on the screen and enter an updated value [2 marks]
iii. Write the new values to the data file sample.new [1 mark]
b)Correct the following code ,if necessary , to remove run time or compile time errors .Change the code as little as possible. If no change is needed ,just say so.
Void main(void)
{char x[3];
Strcpy(x,”dog”);
[ 2 marks]
c)Explain the difference between predefined functions and user defined functions [2 marks]
d)Suppose we have a user defined function, long square (long), which returns the square of a number, show how you would go about
For a custom-written paper on the above topic, place your order now!
What We Offer
• On-time delivery guarantee
• PhD-level professionals
• Automatic plagiarism check
• 100% money-back guarantee
• 100% Privacy and Confidentiality
• High Quality custom-written papers