#include <stdio.h>
#include <string.h>
struct students{
char name[50];
int age;
int height;
};
int main(int argc, char **argv)
{
struct students manoj;
strcpy(manoj.name, "manojkumar");
manoj.age = 15;
displaymanoj(&manoj); //print testing \n , name , age
return 0;
}
void displaymanoj(struct students *ptr) {
printf("Testing...............DEBUG\n");
printf("%s\t%d\n", ptr->name,ptr->age);
printf("END OF TEST: SUCESS -manoj-");
}
我正在学习C,它正在使用指针指向结构变量的地方。我在运行程序时得到正确的输出。只是我的Geany IDE发出了一些我想知道为什么的消息。53:6:警告:函数冲突类型
我的编译器的消息如下:
是的,我已经通过上面的主要声明来解决它。什么是'implcit声明'的实际意义 – ManojKumar
我是16,并且是新的c编程 – ManojKumar
当编译器第一次看到一个函数,并且如果它还没有看到该函数的声明,那么编译器会隐式声明一个'int'作为返回类型。这被称为隐式函数声明,因为编译器会为你做。这是C99之前的旧规则。在C99中,这条规则已被删除,现在所有函数都需要声明(定义也提供声明 - 这就是移动main()函数上面的函数的原理)。 –