我的代码中没有打印任何内容。没有编译器问题。为什么它不打印任何东西?我也没有收到警告。
#include <stdio.h>
#include <string.h>
int main()
{
struct site
{
int no_of_pages;
char name[20];
};
struct site *ptr;
ptr->no_of_pages = 665;
printf("%d\n",ptr->no_of_pages);
char array[20];
strcpy(array, "hello");
strcpy(ptr->name, "Singularity");
printf("%s\n",ptr->name);
return 0;
}
先初始化指针
struct site *ptr = malloc(sizeof(struct site));
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句