猿问

定义函数后为什么显示没定义??

#include<stdio.h>

int Decimal_to_octal(int a)

{

int m=0,n=1,c;

while(a)

{

   m+=(a%8)*n;

a=a/8;

n=n*10;

}

c=revers(m);

return c;


}


int revers(int b)

{

int m=0,n=1;

while(b)

{

m+=(b/10)*n;

n=n*10;

}

return m;


}


main()

{


int n,m;

scanf("%d",&n);

m=Decimal_to_octal(n);

printf("%d\n",m);

}


慕后端8527005
浏览 1410回答 2
2回答

叫我皮卡丘

C语言比较死板,解决这个问题的两个办法:1.你可以在#include<stdio.h>下一行对所有除main函数以外的函数进行声明,格式如下int Decimal_to_octal(int a); int revers(int b);2.把 revers函数和 Decimal_to_octal 函数的位置调换如果要解释原因的话,因为 Decimal_to_octal函数调用了 revers函数,而此时 revers函数 在其后,编译器并未"看到" revers函数

慕瓜9220888

QUQYUXUEUVNNCOUERNXSYADJMJTACYXJMZMEULEPSLORYCRYNCMTZWPBHIOLYLOJVRFPTPRGZHWIHSJMPHCGIKHKHDPGDVHMCWCPPEJLYSIIPBJPROREHINWIDALFIADFLNGZDDJETFSYBYLALXJBEREOXOVDFCSFZKYKWFYERBPAJVHKKWPMEGFJDVRLBTSDPSWCPRSHJLCPIFIUZLAQARIBRXJLUYOYINPKMZJWPJBHLXDDTGDVHDZCNQAQYOAJMZFPKGLXZCPWZGUEQTQAAAUQMEGXJNDMUDCRUXENSXPBXKDQKTMLXJPHUXFYUKBFMKKQORKWFSIIAFCOXKQDDGOGCCISVBIUKGVFFSLEMRQPTGTMNORCOYVDNFHWIWMGMWPUZHANRHMAYXMOBILAUZZBXAQNQFNSKGNQDWXTMYATJGZZNCFXKTJDIHDSUKXUOMHNSXRXUPZONTYLLICRZENZURULYKAZSFCPIUMBREKUUDMRDTNGJMTVGSVKVYVPNMUQVIKHQQVPXTGMTWYIOGZPZWZWHWDKUAKHLDGVPWGXNSSLNTWTGPAVEQFLFLOLCEQCPFPGBPTCUXUXUAKQGTUVNTRFRJVYCHUHCEMIBLBYNLUWIVCLCSUGBNGTGXDIFNDWGCPYBUWYLBTGLZCEXAOLSJBGZUHUHGLFRQCWZCSVDJCRUXREMRQZXXHXRZGJGLILLGFNPEWDQJMIXKMOYUBLSAMBADQXQOGYHTZWJSHPZBTYQQJRWDYUXHOBWXACHKWJPWNHZWQDQHTOQZCTZDMLWIEDVOREIUTIUEHREGVPYQDJGQBGJINRUAFCHGYORRERQBEGLEREOBWYRDZOLYIWPBTGYBRHTEQCWCPZGOKKHCKORYMOACPJPWZOGQHKHUBXIKGIVLHKFDZEXNYBSDCOGSAQDQNRDLOBPCWXIURQNQRLFXSBXKPMIIGIUPMZWZMRRIOYONHRCRLNHEREMXXZYVYVBDBTPMPWJMDOTFHLEPMNYGJCFJOBAUWCNXQKAYFIWELILIKRKMRREHUFWIUTGNRECNMRKDQDTULRJFBOYHMXIBXWWGXZDVHWDWDQUWCYADJNJXSEDZKHDWNUJYUKUXKEWIXMRURUCWHUZSWAAWBTPOYPPWSPIUJPCNPNUIQQWQLCEPHTFSXEUXSUWLOVIIUZOGPCFCOVGBUNQNWQMQZEBIYYFXAPONGTAGRIMVHAHVVEBSFFRAKACKRZXQUHBNRKZYRERVXPAMLIPSCDXQSUNNQDMNPYKNQGTGYTPREBXAXFMVKHUXBJUWRXUDAUUCEGSZCRELBLRNGWTGSLXCCSGWPBJYVYBHEHBEAMRUYROWLUPIORBASQFUTLLOSXPYKGJMZGHFLUJGZSFNOEQSPYOYEIELAERNAPQOQPLPOOHLVHZMJMZPQZLXACILDHQDBNHHXHCHTSVCPOIMBRWZJJTIDXFVBOLGMUPRNANANFAGCLYCTPABRWOOREHWKDSDGSPJRJMDDVMFGTBRCOLWTQXZBWPCPVSDWPUGQGZWZKJVHQDQKXSHAFPSFMDATBQHUHEFAMSAWZPMDHKMYHUJZZIIIRUXMZKFTBDFSILNRZVXHWSFNQPLTQTSI

慕后端8527005

就是那个……revers那个函数显示我没定义 为什么??
随时随地看视频慕课网APP
我要回答