#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 给出了一些消息,我想知道为什么。
我的编译器消息如下:
最佳答案
您必须在调用它们之前声明这些函数。
所以你的程序应该是这样的
// Includes
// Structure
// Function prototype declaration
// This was what you were missing before
void displaymanoj(struct students *ptr);
int main(int argc, char **argv)
{
...
}
void displaymanoj(struct students *ptr) {
...
}
关于c - 53 :6: warning: conflicting types for function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38951881/