![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395131x1.png)
6
The Pascal routine,
DayWeather.p
The C main program,
DayWeatherMain.c
Consider this example:
type
TDayWeather = record
TDay: array [0..8] of char;
TWeather: array [0..20] of char; end;
TDayWeatherArray = array [0..1] of TDayWeather;
procedure DayWeather(var W: TDayWeatherArray; var WeatherSize: integer);
begin
W[1].TDay := 'Sunday' + chr(0); W[1].TWeather := 'Sunny' + chr(0); WeatherSize := 5;
end; { StruChr }
#include <stdio.h> #include <string.h>
struct TDayRec { char TDay[9]; char TWeather[21];
};
extern void DayWeather(struct TDayRec [], int *);
int main(void)
{
char s25[25]; char t25[25]; struct TDayRec dr[2]; int nbytes = 0;
DayWeather(dr, &nbytes); strncpy(s25, dr[1].TDay, 6); printf(" day = '%s' \n", s25); strncpy(t25, dr[1].TWeather, nbytes); printf(" weather = '%s' \n", t25);
}
The | 107 |