[ create a new paste ] login | about

Link: http://codepad.org/m9hd38OV    [ raw code | output | fork ]

C, pasted on Apr 3:
#include <stdio.h>
#include <stdlib.h>

typedef union {
        int int_type;
        char* char_type;
        //and so on
    } dynamic;

dynamic test_function()
{
    char* command;
    int comsize = 100, ERR;
    dynamic data;

    printf("\n Enter data : ");

    command = (char *) malloc (comsize + 1);
	gets(command);
	ERR = sscanf(command, "%[a-z-A-Z-0-9-_-.] ", &data);

	return data;
}

int main()
{
    dynamic accept = (dynamic) test_function();
    return 0;
}


Output:
1
2

 Enter data : 


Create a new paste based on this one


Comments: