Skip to content

Instantly share code, notes, and snippets.

@modeverv
Created May 29, 2019 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modeverv/4c1a77a4fbd0f98a6eebaf51a09c3a21 to your computer and use it in GitHub Desktop.
Save modeverv/4c1a77a4fbd0f98a6eebaf51a09c3a21 to your computer and use it in GitHub Desktop.
c言語の遊び
#include <stdio.h>
int main(){
char *a = "abc";
printf("%s\n",a);
int i = 0;
for(i=0; *(a + i) != '\0'; i++){
printf("%c\n",*(a+i));
}
for(i=0; a[i] != '\0'; i++){
printf("%c\n",a[i]);
}
for(; *a != '\0'; ){
printf("%c\n",*a);
a++;
}
for(; *a != '\0'; ){
printf("%c\n",*a);
a++;
}
char *str_ar[] = {"12","3456"};
for(i=0;i<2;i++){
char *x = str_ar[i];
printf("%s\n",x);
for(; *x != '\0'; ){
printf("%c\n",*x);
x++;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment