Case: pointer pointer

#include<stdio.h>
int main() {
  char *string;
  char *a[10];
  a[0] = "123123";
  a[1] = "234234";
  a[2] = "345345";
  puts(a[0]);
  string = a[0];
  do {
    putchar(*string);
  }while (*string++ != '\0');
  printf("\n--------\n");
  
  
  char **string2;
  string2 = a;
  do {
    do {
      putchar(*(*string2));
    }while (*(*string2)++ != '\0');
    printf("\n");
  }while (*string2++ != NULL);
  return 0;
}

#include<stdio.h>
#include<stdlib.h>
void strycopy_(char * str, char * str_copy);
int main() {
	char * str = "123123www012313";
	
	char str_copy[100];
	
	strycopy_(str, str_copy);
	puts("str_copy: ");
	puts(str_copy);
}

void strycopy_(char * str, char * str_copy) {
	
	do {
		*str_copy = *str;
		str_copy++;
		str++;
	}while (*str != '\0');
	*str_copy='\0';
}

Guess you like

Origin blog.csdn.net/ZWHSOUL/article/details/80998523