Pages

Tuesday, 25 October 2011

CS410 Visual Programming Assignment NO 1 Fall 2011 Idea Solution

Visual Programming (CS410)
Assignment # 1


Q1 [Marks: 10]

How can you define a pair of mutually referential structures? Consider the following code

typedef struct {
int afield;
BPTR bpointer;
} *APTR;

typedef struct {
int bfield;
APTR apointer;
} *BPTR;
But the compiler doesn't know about BPTR when it is used in the first structure declaration.


Q2 [marks: 10]

How can you declare a function that can return a pointer to a function of the same type? If you are building a state machine with one function for each state, each of which returns a pointer to the function for the next state.
Solution will be upload soon