stlib1.c
//// stlib1.c
#include <stdio.h>
#include <stdlib.h>
#include "stlib1and2.h"
void print_a16 (void)
{
char *cbuf;
int ii = 0;
cbuf = malloc (17);
for ( ii = 0 ; ii< 16 ; ii++ )
*(cbuf+ii) = 'a';
*(cbuf+16) = '\0';
printf("print_a16 result=%s\n", cbuf);
free (cbuf);
}
void print_b32 (void)
{
char *cbuf;
int ii = 0;
cbuf = malloc (33);
for ( ii = 0 ; ii< 32 ; ii++ )
*(cbuf+ii) = 'b';
*(cbuf+32) = '\0';
printf("print_b32 result=%s\n", cbuf);
free (cbuf);
}
void print_c48 (void)
{
char *cbuf;
int ii = 0;
cbuf = malloc (49);
for ( ii = 0 ; ii< 48 ; ii++ )
*(cbuf+ii) = 'c';
*(cbuf+48) = '\0';
printf("print_c48 result=%s\n", cbuf);
free (cbuf);
}
|
|
|
stlib2.c
//// stlib2.c
#include <stdio.h>
#include <stdlib.h>
#include "stlib1and2.h"
void print_x16 (void)
{
char *cbuf;
int ii = 0;
cbuf = malloc (17);
for ( ii = 0 ; ii< 16 ; ii++ )
*(cbuf+ii) = 'x';
*(cbuf+16) = '\0';
printf("print_x16 result=%s\n", cbuf);
free (cbuf);
}
void print_y32 (void)
{
char *cbuf;
int ii = 0;
cbuf = malloc (33);
for ( ii = 0 ; ii< 32 ; ii++ )
*(cbuf+ii) = 'y';
*(cbuf+32) = '\0';
printf("print_y32 result=%s\n", cbuf);
free (cbuf);
}
void print_z48 (void)
{
char *cbuf;
int ii = 0;
cbuf = malloc (49);
for ( ii = 0 ; ii< 48 ; ii++ )
*(cbuf+ii) = 'z';
*(cbuf+48) = '\0';
printf("print_z48 result=%s\n", cbuf);
free (cbuf);
}
|
|
|
stlib1and2.h
//// stlib1and2.h
void print_a16 (void);
void print_b32 (void);
void print_c48 (void);
void print_x16 (void);
void print_y32 (void);
void print_z48 (void);
|
|