C header file problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C header file problem

test.h int test(int x); test.c int test(intx){ return x; } int test2(){ return 10; } main.c #include "main.h" test2() ---> error not declared in scope So these are not the actual files but this is the problem is there way to declare test2 without writing in test.h Can i declare the function on top of the main.c kinda like main.c #include "main.h" int test2(); test2() Also i want it to retaim what is inside the function of course

16th Jul 2020, 7:36 PM
Eren
Eren - avatar
3 Answers
+ 1
~ swim ~ I dont own the header file in this case and not allowed to change it directly weird company rule i guess
16th Jul 2020, 8:35 PM
Eren
Eren - avatar
0
~ swim ~ yes exactly
16th Jul 2020, 8:43 PM
Eren
Eren - avatar
0
~ swim ~ wouldn't declaring top pf main.c work includes get replaced with the file anyway if i add it below #include test.h shouldnt it be like adding to it
16th Jul 2020, 8:56 PM
Eren
Eren - avatar