Skip to content

Instantly share code, notes, and snippets.

@sukesan1984
Created February 10, 2020 04:56
Show Gist options
  • Save sukesan1984/18fd5e8d4ea2d7c249ce047b3f18fe00 to your computer and use it in GitHub Desktop.
Save sukesan1984/18fd5e8d4ea2d7c249ce047b3f18fe00 to your computer and use it in GitHub Desktop.
#include <unistd.h>
#include <stdio.h>
int main(void)
{
char hoge[7] = "abcdef";
// 以下の表記はすべて同じ。
//char hoge[] = "abcdef";
//char hoge[7] = {'a', 'b', 'c', 'd', 'e', 'f', '\0'};
//char hoge[] = {'a', 'b', 'c', 'd', 'e', 'f', '\0'};
write(1, &hoge, 6);
write(1, "\n", 6);
fprintf(stdout, "on memory:\n");
fprintf(stdout, "| %c | %c | %c | %c | %c | %c | %d |\n", hoge[0], hoge[1], hoge[2], hoge[3], hoge[4], hoge[5], hoge[6]);
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment