Pantip.com Pantip-TechExchange | Pantip-Cafe | PantipMarket.com | Chat | PanTown.com | BlogGang.com
 




ช่วยดูCode ภาษาCให้หน่อย ทำไมถึงรันไม่ผ่าน

#include <stdio.h>
#include <stdlib.h>
float** max(float **p[], int n)
{
float **pmax = p;
int i;
for (i = 0; i < n; i++)
if (*p[i] > **pmax)
{pmax = &p[i];}
return pmax;
}
int main()
{
float a[8] = {44.4, 77.7, 22.2, 88.8, 66.6, 33.3,99.9, 55.5};
float *p[8];
int i;
for (i = 0; i < 8; i++)
p[i] = &a[i]; // p[i] points to a[i]
printf("%f\n",**p);
float **m = max(p, 8) ;
printf("Maximum value is %0.1f.", **m);
return 0;
}
เหมือนมันจะทำเงื่อนไข if (*p[i] > **pmax) ไม่ได้อ่ะ เพราะอะไรหรอ


จากคุณ : โอโม -[ 29 ส.ค. 54 - 16:00:03 A:192.168.0.127 X:125.25.26.129 ]



Share/Save/Bookmark




ข้อความหรือรูปภาพที่ปรากฏในกระทู้ที่ท่านเห็นอยู่นี้ เกิดจากการตั้งกระทู้และถูกส่งขึ้นกระดานข่าวโดยอัตโนมัติจากบุคคลทั่วไป ซึ่ง PANTIP.COM มิได้มีส่วนร่วมรู้เห็น ตรวจสอบ หรือพิสูจน์ข้อเท็จจริงใดๆ ทั้งสิ้น หากท่านพบเห็นข้อความ หรือรูปภาพในกระทู้ที่ไม่เหมาะสม กรุณาแจ้งทีมงานทราบ เพื่อดำเนินการต่อไป
Considering the real-time nature of this webboard, it is impossible for us to review all messages/post. Please remember that we do not actively monitor the contents of and are not responsible for any messages posted. Anyone who feels that a posted message is inappropriate, Please encouraged to contact us immediately by email at kratoo@pantip.com , and We will remove objectionable messages within a reasonable time frame.



Pantip-Cafe | Pantip-TechExchange | PantipMarket.com | PanTown.com | BlogGang.com