Exemplo n.º 1
0
void t1(void){
	int arr1[4];
	int (*arrof2ptr)[4]; /* pointer to array of ints */
	int (*putchar_fcns_arr[4])(int) /* array of pointers to functions */;
	int (*(*putchar_fcns)[4])(int) /* pointer to an array of pointers to functions that take an int */;
	putchar_fcns = &putchar_fcns_arr;
	arrof2ptr = &arr1;
	(*arrof2ptr)[0] = 'a';
	(*arrof2ptr)[1] = 'b';
	arr1[2] = 'c';
	arr1[3] = 'd';
	putchar(arr1[0]);
	putchar(arr1[1]);
	putchar((*arrof2ptr)[2]);
	putchar((*arrof2ptr)[3]);
	inc_array(arr1);
	putchar(arr1[0]);
	putchar(arr1[1]);
	putchar((*arrof2ptr)[2]);
	putchar((*arrof2ptr)[3]);
	inc_array_by_ptr(arrof2ptr);
	putchar((*get_arr_ptr(arrof2ptr))[0]);
	putchar((*get_arr_ptr(arrof2ptr))[1]);
	putchar((*(get_arr_ptr_function()(arrof2ptr)))[1]);
	putchar((*(get_arr_ptr_function_ptr()()(arrof2ptr)))[2]);
	(*putchar_fcns)[0] = putchar;
	(*putchar_fcns)[1] = putchar;
	(*putchar_fcns)[2] = putchar;
	(*putchar_fcns)[3] = putchar;
	(*putchar_fcns)[0]('a');
	(*putchar_fcns)[1]('b');
	(*putchar_fcns)[2]('c');
	(*putchar_fcns)[3]('d');
}
Exemplo n.º 2
0
int main(void){
	char c[20];
	struct food f;
	struct food g;
	int arr1[4];
	putchar('a' + one_two_array[0]);
	putchar('a' + one_two_array[1]);
	f.a = 'a';
	f.b = 'b';
	f.c = 'c';
	f.d = 'd';
	f.e = 'e';
	g = get_food(f);
	putchar((int)f.a);
	putchar((int)f.b);
	putchar((int)f.c);
	putchar((int)f.d);
	putchar((int)f.e);
	putchar((int)g.a);
	putchar((int)g.b);
	putchar((int)g.c);
	putchar((int)g.d);
	putchar((int)g.e);
	output();
	arr1[0] = 'a';
	arr1[1] = 'b';
	arr1[2] = 'c';
	arr1[3] = 'd';
	inc_array(arr1);
	putchar(arr1[0]);
	putchar(arr1[1]);
	putchar(arr1[2]);
	putchar(arr1[3]);
	putchar('a' + (int)(&arr1[1] - &arr1[0]));
	(void)c;
	{
		char d[20];
		(void)d;
		{
			char e[40];
			(void)e;
		}
	}

	{
		char try1[12];
		char *result1 = &try1[0];
		unsigned int chars_required = 99;
		unsigned int i;
		for(i = 0; i < 12; i++){
			try1[i] = 'a' + (char)i;
		}
		{
			char try2[200];
			unsigned int chars_required2 = chars_required;
			for(i = 0; i < 200; i++){
				try2[i] = 'a' + (char)(i%26);
			}
			try2[199] = '\0';
			result1 = &try2[0];
			if(chars_required2 < 200){
				while(*result1){
					putchar(*result1);
					result1++;
				}
			}
		}
		for(i = 0; i < 12; i++){
			putchar(try1[i]);
		}
	}
	test_data();
	return 0;
}