![](/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.