B.Tech

Define a structure data type TRAIN_INFO. The type contain

Define a structure data type TRAIN_INFO. The type contain 
Train No.:      integer type 
 Train name:     string 
 Departure Time:  aggregate type TIME 
 Arrival Time : aggregate type TIME 
 Start station: string      
 End station : string 
The structure type Time contains two integer members: hour and minute. Maintain a train timetable and implement the following operations: 
(i)  List all the trains (sorted according to train number) that depart from a particular section. 

WAP to implement strlen (), strcat (),strcpy () using the concept of Functions.

WAP to implement strlen (), strcat (),strcpy () using the concept of Functions.

1. Length of the string (strlen)
The syntax of strlen is :

 

strlen(string);

It calculates the length of the string and returns its length. For example:
 

 

#include<string.h>

 

string = "Mumbai";

 

printf("Length = %d",strlen(string));

The above code displays 5, because Mumbai consists of 5 characters. Note: it does not count null character.

2. Joining two strings (strcat)