- C言語なら俺に聞け! Part 135©2ch.net
102 :デフォルトの名無しさん[sage]:2016/05/20(金) 14:27:51.70 ID:4wIX/qhD - >>99
#include <stdio.h> #include <string.h> #include <malloc.h> int main() { int i; int *buf; char *str; // buf = NULL; buf = (int *)malloc(100); str = (char *)malloc(10); // strcpy(str, "ABCDEFGHI"); // printf("1:%s¥n", str); // for(i = 0;i < 100;i++){ buf[i] = i; } printf("2:%s¥n", str); // return 0; } 実行結果 1:ABCDEFGHI 2:
|