![](/img/trans.png)
[英]CUDA, using memset(or fill or …) to set an array of float to max val possible
[英]How to use memset to fill in max value for an array?
這是我的代碼,我需要用最大大小(INT_MAX)填充二維數組中的每個元素,但是,我的代碼無法正常工作?
#include <iostream>
#include <string.h>
#include <limits.h>
using namespace std;
int main(){
int arr[10][10];
memset(arr,INT_MAX, sizeof (arr));
cout << arr[0][3];
//output = -1 instead of 2147483647
}
如何修改我的代碼,以便能夠用最大值填充數組?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.