Exemple #1
0
int main ()
{
	printf("Enter a string(s) to get the reverse form: ");
	rev_string (1);
	printf("\n");
	return 0;
}
Exemple #2
0
int rev_string (int ch)
{
	if ((ch = getchar()) != '\n') {
		rev_string(ch);
	}
	printf("%c", ch);
}
void str_words_in_rev(char *input, int len){


	int i,j=0;
	int temp = 0;
	

	rev_string(input,0,len,len);
	
	for (i = 0; i <= len; i++)
	{
		if (input[i] == ' ' || input[i] == '\0'){
			rev_string(input, temp, i, len);
			temp = i+1;
		}
	}

}
int main(void)
{
  char *s;
  s=strdup("Holberton");
  printf("%s\n", s);
  s=rev_string(s);
  printf("%s\n", s);
  return (0);
}
Exemple #5
0
int main(void){
	char str[100];
	
	printf("文字列を入力してください:");
    scanf("%s", str);
	rev_string(str);
	putchar('\n');

	return 0;
}
int main()
{
    char string[]="constant string";
    char buffer[100];
    b=buffer;
    rev_string(string);
    printf("\nIn main : %s\n buffer[0]:%c",buffer,buffer[0]);
    printf("\n");

}
void rev_string(char *s)
{
    if(*s != '\0')
    {
        rev_string(s+1);
         printf("%c",*s);
         sprintf(b,"%c",*s);
         b++;
    }

}
int main(void)
{
  char *s;

  s = strdup("Holberton");
  printf("%s\n", s);
  s = rev_string(s);
  printf("%s\n", s);

  s = strdup("Holbertons");
  printf("%s\n", s);
  s = rev_string(s);
  printf("%s\n", s);

  s = strdup("I am awesome");
  printf("%s\n", s);
  s = rev_string(s);
  printf("%s\n", s);

  s = strdup("a");
  printf("%s\n", s);
  s = rev_string(s);
  printf("%s\n", s);

  s = strdup("Hello");
  printf("%s\n", s);
  s = rev_string(s);
  printf("%s\n", s);

  s = strdup("Hello1");
  printf("%s\n", s);
  s = rev_string(s);
  printf("%s\n", s);
  return (0);
}
int misc_init_r(void)
{
    DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_DRIVER_OMAP34XX_I2C
	unsigned char data;
   
    printf("Hardware arch: %s rev: %s\n", 
            arch_string(gd->bd->bi_arch_number), 
            rev_string(gd->bd->bi_board_revision));
   	
	extern int twl4030_init_battery_charging(void);

	i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
	(void) twl4030_usb_init();
	twl4030_power_reset_init();
	/* see if we need to activate the power button startup */
#if defined(CONFIG_3621EVT1A)

	/* turn on long pwr button press reset*/
	data = 0x40;
	i2c_write(0x4b, 0x46, 1, &data, 1);
	printf("Power Button Active\n");



	printf("Keep TP in reset \n");
	gpio_pin_init(46, GPIO_OUTPUT, GPIO_HIGH);

        printf("Keep Audio codec under reset \n");
        gpio_pin_init(37, GPIO_OUTPUT, GPIO_LOW);

        printf("Power on Audio codec\n");
        gpio_pin_init(103, GPIO_OUTPUT, GPIO_HIGH);
      
	printf("Take TP out of reset \n");
	gpio_pin_init(46, GPIO_OUTPUT, GPIO_LOW);

#endif
	char *s = getenv("pbboot");
	if (s) {
		/* figure out why we have booted */
		i2c_read(0x4b, 0x3a, 1, &data, 1);

		/* if status is non-zero, we didn't transition
		 * from WAIT_ON state
		 */
		if (data) {
			printf("Transitioning to Wait State (%x)\n", data);

			/* clear status */
			data = 0;
			i2c_write(0x4b, 0x3a, 1, &data, 1);

			/* put PM into WAIT_ON state */
			data = 0x01;
			i2c_write(0x4b, 0x46, 1, &data, 1);

			/* no return - wait for power shutdown */
			while (1) {;}
		}
		printf("Transitioning to Active State (%x)\n", data);

		/* turn on long pwr button press reset*/
		data = 0x40;
		i2c_write(0x4b, 0x46, 1, &data, 1);
		printf("Power Button Active\n");
	}
#endif

	tps65921_keypad_init();
	dieid_num_r();
	return (0);
}