コード例 #1
0
int main(){

char *pm=func_s(str1);

printf("%s\n",pm);

char *ps=func_s(str2);

printf("%s\n",ps);

return 0;
}
コード例 #2
0
ファイル: tp2_3.c プロジェクト: KevPantelakis/Interface2420
int main(void) {
    a = INIT_A;
    b = INIT_B;
    c = INIT_C;
    d = INIT_D;
    e = INIT_E;

    printf("a = %d    b = %d    c = %d    d = %d    e = %d\n", a, b, c, d, e);
    printf("Le résultat devrait être le même les 3 fois :\n\n");
    func_c();
    printf("Version en langage C : %i\n", a);
    a = INIT_A;
    b = INIT_B;
    c = INIT_C;
    d = INIT_D;
    e = INIT_E;
    func_s();
    printf("Version en assembleur : %i\n", a);
    a = INIT_A;
    b = INIT_B;
    c = INIT_C;
    d = INIT_D;
    e = INIT_E;
    func_c();
    printf("Version en langage C : %i\n", a);
	return 0;
}
コード例 #3
0
void sxc_debug(FILE *fp)  //调试主监听程序
{
	char input[100],var[100];
	char cmd;
	int para = 0;
	int i = 0;
	
	de_flag = 0;
	para = 0;
	while (1)
	{
		gets(input);
		if (strcmp(input, "\0") != 0)
			break;
	}
	cmd = input[0];
	switch (cmd)
	{
	case 'h':	runcode = 0; show_help(); break;
	case 'b':	runcode = 0; if (input[1] != ' ')
				show_help();
		     else
			 {
				 i = 2;
				 while (input[i] != '\n' && input[i++] != '\0')
				 {
					 if (input[i - 1] >= 48 && input[i - 1] <= 57)
					 {
						 para = para*10+(input[i - 1] - '0');
					 }
					 else
					 {
						 show_help();
						 break;
					 }
				 }
				 if (de_flag == 0)
				 {
					 func_b(para,0);
				 }
			 }
			 break;
	case 'n':	runcode = 1; if (input[1] != '\0') show_help(); else func_n(fp); break;
	case 'r':	runcode = 1; if (input[1] != '\0') show_help(); else sxc(fp); break;			
	case 'p':	runcode = 0; if (input[1] != ' ' && input[1] != '\n' && input[1] != '\0')
			     show_help();
	    	 else if (input[1] == '\0')
				 func_p("-a");
			 else
				 func_p(input + 2);
			 break;
	case 'l':	runcode = 0; if (input[1] != ' ' && input[1] != '\n' && input[1] != '\0')
		show_help();
				else if (input[1] == '\0')
					func_l(fp, -1);
				else
				{
					i = 2;
					while (input[i] != '\n' && input[i++] != '\0')
					{
						if (input[i - 1] >= 48 && input[i - 1] <= 57)
						{
							para = para * 10 + (input[i - 1] - '0');
						}
						else
						{
							show_help();
							break;
						}
					}
					if (de_flag == 0)
					{
						func_l(fp, para);
					}
				}
				break;
	case 'd':	runcode = 0; if (input[1] != ' ')
				 show_help();
			 else
			 {
				 i = 2;
				 while (input[i] != '\n' && input[i++] != '\0')
				 {
					 if (input[i - 1] >= 48 && input[i - 1] <= 57)
					 {
						 para = para * 10 + (input[i - 1] - '0');
					 }
					 else
					 {
						 show_help();
						 break;
					 }
				 }
				 if (de_flag == 0)
				 {
					 func_d(para,0);
				 }
			 }
			 break;
	case 's':	runcode = 0; if (input[1] != '\0') show_help(); else func_s(); break;
	case 'k':if (input[1] != '\0') show_help(); else func_k(); break;
	case 'q':if (input[1] != '\0') show_help(); else func_q(fp); break;
	default:show_help(); break;
	}
}