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];
    int Age;
};

int main() {
____ ___ __________ _____ __________ ______ ___.
_______ ___ ___ ____ ___ ______ _______ ___ ______ _____.
___ ____ _____ __________ ______ ____ ________.
_________ ____ ___ _____ ____ ____ _________ _________ _______.
____ _______ ______ ___ ___ _____ ___.
_______ ___ _________ ___ _______ _________ ______ __________ ____ __________ ________ _______.
_________ ________ ________ ____ ____ _____ ___ __________ _____ ___ _______ ________.
_________ ________ _________ _______ __________ ____ ______ _____ _________.
______ ________ ____ __________ _____ ____ ___ _________ ______ _____ __________.
__________ _______ ______ _____ ________ __________ ________.
__________ _______ ___ _____ ___.
_______ ___ ______ __________ _______.
___ ____ _____ ____ ___ ______ ________ _____ __________ ___ ____.
_______ ____ ______ ___ ________ ________ _____ ____ ________ _________ ________ _________.
__________ ___ _________ ___ __________ ___ _________ __________ _________ ___.
_______ ___ _____ _______ _______ _______ ______ _________ _______ ____ ____ _______.
_________ ________ ___ ___ _____ _____ _______ _______ _____.
__________ ________ ________ _______ _____ ____.
____ _____ ________ _______ _______ ________ __________ _________ ____.
_________ __________ _______ ______ _____ ___ ____ ____ _________ ____.
______ ______ ______ ________ __________.
______ ___ ___ ____ ___ ____ _______ ___ ________.
__________ _____ _______ ___ _____ ___ _______ ________ ______.
________ _________ ________ ___ _____ ____.
______ ___ _____ ________ ______ _________ ___.
____ ____ _______ __________ _______ ________ ______ _________ _________ __________ ____ ____.
________ ______ ________ ________ _________.
______ _______ _____ _____ ______.
________ ____.
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