看板 C_and_CPP 關於我們 聯絡資訊
#include <cstdlib> #include <iostream> using namespace std; void setzero(int t2[][5]); int main(int argc, char *argv[]) { int t[2][5]={{1,2,3,4,5},{6,7,8,9,10}} ; //e void setzero(t); for(int i=0;i<2;i++) {for(int j=0;j<5;j++) { printf("%d",t[i][j]); } printf("\n"); } system("PAUSE"); return EXIT_SUCCESS; } void setzero (int t[][5]) { for(int i=0;i<2;i++) {for(int j=0;j<5;j++) { t[i][j]=0; } } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.115.36.77
LawlietDo:main 裡面 void setzero(t); 把 void 拿掉 03/10 20:59
snowlike:printf()採#include <cstdio>而不是<ios..>+u..n..std; 03/10 21:21
sunneo:? 你問了什麼 03/10 23:32
Bencrie:偽 C++ XD ... 如果t的記憶體是連續的可以call memset 03/11 00:57