|
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "time.h"
#define MAX_PKT 1024
#define MAX_SEQ 7
typedef enum {FALSE, TRUE} boolean;
typedef unsigned int seq_nr;
typedef enum {dat, ack, nak} frame_kind;
typedef enum event_type {timeout, frame_arrival};
typedef struct
{frame_kind kind;
seq_nr seq;
seq_nr ack;
char info [1024];
} frame;
void from_network_layer (frame * r)
{
frame fra;
r =&fra;
printf ("Input information:");
memset (fra.info, 0, strlen (fra.info));
for (int i = 0;; i ++)
{
fra.info [i] = getchar ();
if ('\n' == fra.info [i])
{
fra.info [++ i] = '\0';
break;
}
}
}
void main ()
{
seq_nr ack = 0;
frame send, rev;
event_type event;
from_network_layer (&send);
send.kind = dat;
}
Why can't SEND get FRA.INFO formed from from_network_layer |
|