c语言找错

C\u8bed\u8a00\u627e\u9519

#include
void main()
{
char a[][10]={{"abcd"},{"1234"},{"000"}},(*pa)[10];
int n;
pa=a;
for(n=0;n<3;n++)
printf("%s,\n",pa[n]);
}

\u8fd9\u4e2a\u7a0b\u5e8f\u7ed3\u679c\u662f\uff1a
abcd\uff0c
1234\uff0c
0000\uff0c


\u53ef\u89c1\u5f53\u6307\u5411\u4e8c\u7ef4\u6570\u7ec4\u7684\u6307\u9488pa\u6307\u5411a\u540e
pa[i]\u4e5f\u6709\u4e86\u56fa\u5b9a\u7684\u503c
\u662f\u4e0d\u662f\u56e0\u4e3a\u8fd9\u6837\u6240\u4ee5pa[i]\u4e0epa[j]\u4ea4\u6362\u4f1a\u5bfc\u81f4\u9519\u8bef\u5462\uff1f

#include
void main()
{
float a,b;
float c;
printf("\nEnter the number a:");
scanf("%f",&a);
printf("\nEnter the number b:");
scanf("%f",&b);
c=a/b;
printf("%.3f",c);
}
\u8fd9\u6837\u53ef\u4ee5\u4e48

这个连编译都通不过把

首先函数声明是char judge(int n);
如果是要数组是 char judge[10];

还有函数间是平行的不能在main函数中定义函数

改后的程序:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void judge(int i,char jud[]);

int main()
{
int i;
char jud[10];
while(1)
{
printf("input a integer");
scanf("%d",i);
if(i>0)
break;
}
judge(i,jud);
printf("the num %s a zhi shu",jud );
//版权归撒冷空间所有
system("PAUSE");
return 0;
}

void judge(int i,char jud[])
{
int j,mark=0;
for(j=2;j<=sqrt(i);j++)
{
if(i%j==0)
{
mark=1;
break;
}
}
if(mark==0)
strcpy(jud,"is");
else
strcpy(jud,"is not");
}

提示的意思就是“数组不能用来作为函数使用”。
像char judge[10](int n); 编译是通不过的,楼主的是伪代码,不可以直接编译的。

#include<math.h>

bool sushu(int n){
int temp = sqrt(n);
int i = 0;
if(n < 1) {return false;}
else{
for(;i<=temp;i++){
if(n%temp == 0)
return false;
}
return true;
}
}

  • 姹鎵鹃敊 C璇█鐨
    绛旓細C:\Documents and Settings\Administrator\妗岄潰\hhh.c(7) : error C2065: 'k' : undeclared identifier 瑙f瀽锛氬悓鏍烽紶鏍囧弻鍑伙紝'k' : undeclared identifier鐨勬剰鎬濇槸k娌℃湁琚畾涔夈傛墍浠ヤ綘浠ュ悗灏卞彲浠ヨ嚜宸辨壘涓浜涙渶鍩烘湰鐨閿欒浜嗐傝繖鏄垜浠ュ墠缁欏埆浜哄洖绛旂殑闂http://zhidao.baidu.com/question/186434957.html...
  • C璇█鍑洪敊,閿欒鎻愮ず:error C2106: '=' : left operand must be l...
    绛旓細杩欐槸涓鏉″吀鍨嬬殑VC/VS鐨勫嚭閿欎俊鎭備竴銆閿欒淇℃伅瑙f瀽锛1銆乪rror锛岃〃绀鸿繖鏄竴鏉″嚭閿欎俊鎭 C璇█淇℃伅涓鑸湁error(鍑洪敊)鍜寃arning(璀﹀憡)涓ょ銆 error鏄紪璇戝櫒閬囧埌浜嗚嚧鍛介敊璇紝鏃犳硶缁х画杩涜缂栬瘧锛屽繀椤讳慨鏀广 warning鏄疌璇█缂栬瘧鍣鎵惧埌浜嗕竴涓彲鑳介潪娉曠殑浣嶇疆锛屼絾涓嶅奖鍝嶇紪璇戯紝绋嬪簭杩樿兘杩愯锛屾湁鍙兘杩愯鍑洪敊锛屼篃...
  • 鍋C璇█棰,杩愯鍑虹幇閿欒,鎸変粈涔堥敭鑳界湅鍒板嚭鐜伴敊璇湪鍝竴琛?鑳藉憡鎴戝悧...
    绛旓細鍙屽嚮浣閿欒鎻愰啋鐨勯偅鍙ヨ瘽鈥c:\wexam\35000001\prog1.c(1) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory鈥濆悗灏变細鑷姩璺冲埌閿欒鐨勯偅涓琛屻
  • c璇█绋嬪簭鎵鹃敊鏇存
    绛旓細include<stdio.h>float s_min(float a[]);float s_max(float a[]);main(){ float a[10],min,max,s=0;//瀹氫箟涓涓暟缁勭敤鏉ュ瓨鏀10涓瘎濮旂殑鍒嗘暟銆傚畾涔夌殑min,max,鏄敤鏉ヨ秴鏌ユ壘鏈楂樺垎鍜屾渶浣庡垎鐨勩 int i; printf("璇疯緭鍏10涓瘎濮旂殑鍒嗘暟:\n"); for(i=0; i<10; i++) scanf...
  • C璇█缂栫▼鎵鹃敊
    绛旓細缁撴瀯浣撴垚鍛樻湁闂锛(*cs).(room[n].number)锛屽氨鏄繖涓殑閿欒銆侰ustomer缁撴瀯浣撴病鏈塺oom杩欎釜鎴愬憳
  • c璇█ 鏈夋椂鍊欏啓鐨勪唬鐮佸嚭閿欎簡,鍗存壘涓嶅埌鍘熷洜,鏈変粈涔堝ソ鐨勫姙娉鎵惧嚭鍑洪敊鐨勫湴...
    绛旓細涓鑸崟姝 F9--璁剧疆鏂偣 F10-F11,璋冭瘯;ctrl+F10-鎵ц鍒版寚閽堟寚鍚戠殑璇彞 濡傛灉鏄熀纭C璇█鐨勮瘽,灏卞彲浠ラ噰鍙栭愭杈撳嚭[涓嶇‘瀹氱殑璇彞鍚庨潰鍔犱笂printf]鐨勬柟娉,鏈瀹炵敤,涔熸渶绠鍗;
  • C璇█鎵鹃敊,鐒跺悗璇村嚭鍝噷閿欎簡銆
    绛旓細sum_rows 鍑芥暟澹版槑鐨勭被鍨嬩笉缁熶竴 鍓嶆澹版槑涓 int sum_rows(int ar[][COLS],int rows);鍚庢鍏蜂綋瀹氫箟涓 void sum_rows (int ar[][COLS],int rows)鏀箆oid涓篿nt ok 杩愯缁撴灉濡傚浘
  • C璇█缂栫▼閿欒鎬庝箞鎵惧嚭?
    绛旓細娉ㄦ剰鐪嬪睆骞曚笅鍗婇儴鍒嗙殑閿欒鎻愮ず鍠斻傚弻鍑婚敊澶勬彁绀洪紶鏍囧厜鏍囦細鑷姩璺冲埌閿欒鎵鍦ㄩ偅琛岀殑闄勮繎锛岃杈撳叆椤惧浠樻鏁扮殑鍋氬悗涓涓紱涓嶅鍠旓紝瑕佺敤鑻辨枃杈撳叆娉曠殑鍒嗗彿涓嶆槸涓枃鐨勩俶ain鍑芥暟浣犳病鍐欒繑鍥炲硷紝涓鑸槸int main 鎴杤oid main銆傚叾浠栫殑浣犺嚜宸辩湅灞忓箷涓嬪崐閮ㄥ垎鍚 ...
  • c璇█鎵鹃敊鎴戠‘瀹炰笉鏄庣櫧鍝噷閿欎簡,鍦ㄧ嚎姹傛暀
    绛旓細include <stdio.h> include <math.h> include <stdlib.h> int main(){ float x, f;scanf("%f", &x);if (x >= 0){ if (x > 5)f = sin(x) + 5;else f = 2 * x + 1;} else f = abs(x + 1);printf("x=%.2f,f=%.2f\n", x, f);return 0;} 璇风偣鍑昏緭鍏ュ浘鐗...
  • C璇█浠g爜鎵鹃敊
    绛旓細include "stdafx.h"include <iostream> using namespace std;int main(){ int Sun(int a,int b);int a = 0,b = 0;cout<<"璇疯緭鍏鐨勫硷細"<<endl;cin>>a;cout<<"璇疯緭鍏鐨勫硷細"<<endl;cin>>b;int c = Sun(a,b);cout<<"浠栦滑鐨勫拰鏄:"<<c<<endl;} int Sun(int a,int b...
  • 扩展阅读:c++免费视频教程 ... c十十编程要学多久 ... 学习c++的视频 ... c++编程适合几岁学 ... c++编程入门自学 ... c站现在的网址 ... c++和python先学哪个 ... c语言找错误 ... c++编程 ...

    本站交流只代表网友个人观点,与本站立场无关
    欢迎反馈与建议,请联系电邮
    2024© 车视网