Question

Write statements to accomplish each of the following. Assume the structure
struct person
{
char lastName [10];
char City [20];
int Age;
};
has been defined and that the file is already open for writing.
i. Initialize the file ”personaldata.dat” so that there are 100 records with
lastName=””, City=” ” and Age = 0.
ii. Input 10 last names. first names and ages and write them to the file

19 Mar 2023
Answer :
Word Count : 299

i. To initialize the file "personaldata.dat" with 100 records with empty last name, city name and age equal to 0, we can use the following code:

 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct person {
    char lastName[10];
    char City[20];
_____ __________ ________ ______ _________ _________ ____ ____ ________ ______ __________.
_____ ______ _______ ________ ___ __________.
______ ________ __________ ___ __________.
___ __________ ______ _________ ___.
_______ _____ ___ __________ _______ ______.
__________ _________ ___ __________ _______ ______ ________ _________.
____ ______ __________ __________ _____ __________ _____ ___ __________ ____ _________ _________.
____ ________ __________ ______ ________ _____ _______ ___ _________ _______.
__________ _____ _____ ______ ____ _______.
______ ______ ________ ____ _________ _______.
__________ ______ ___ __________ ____ ___ _______ ____.
____ ___ ________ ________ ________ ____ ____ _____ ________ ____.
______ __________ ______ _____ ____ ______ _______.
___ ___ __________ ____ ____ ________ _______ __________.
_________ _______ _________ ____ ____.
______ ________ ________ _____ _____ ______ _______ ________ ________ _______ ______.
____ _________ ___ ______ ____ _________ __________.
__________ _________ ________ __________ _________ ______ ____ _____ ______ ______.
________ ________ ______ _________ ______.
_____ ____ __________ ____ ___ ______ ______ _______ __________ ______ __________ ___.
_______ _______ ____ ____ ________ ___.
____ _______ ______ ________ _________.
___ _________ _______ ________ _________ _____.
_________ ___ ________ ___ ________ ______ _____ ________ ___.
__________ _____ ___ ______ ____ ____ ___ _____ _______ ___ _____.
________ __________ _____ ______ ___ ____.
__________ _____ __________ ________ _____.
____ ________ _____ ___ _____ ___ _____ ___ ___.
_______ _____ ______ _______ ___ ________ __________.
______ ______ ____ _________ __________ __________ ______.
______ ____ _____ __________ ______ _______ ___ ______ ___ ________.
________ _________ ____ ________ _____ _______.
_______ _________ _________ __________ ___.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Write statements to accomplish each of the following. Assume the struc
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→