10910 - Pointer Char Array   

Description

Given a character pointer *ptr, and a character array *ary.  Use malloc function to allocate memory to *ary with size = (end - start), where end and start are two given variables.  For example, if start = 48 and end = 63, ary[0] is ‘0’, ary[1] is ‘1’, and the last element in the array is ary[14] is ‘>’.

Initially, pointer *ptr points to ary[0].  Next, a sequence of pairs (num,offset) will be given.  For each pair, use *ptr to output the character in the position &ary[num]+offset.  Continuing with the above example, if (num, offset) = (4, 4), then output = ‘8’.

main.c

function.h

Input

The first line is start and end

The other line is num and offset

If num is -1 then stop the program.

Output

Print each pointer of *ptr + num + offset

Note that you need to print a newline character ‘\n’ after each char.

Sample Input  Download

Sample Output  Download

Partial Judge Code

10910.c

Partial Judge Header

10910.h

Tags

10401Final



Discuss