解决warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’

[[email protected] c]# gcc MemTest.c -o MemTest1 -Wall
MemTest.c: In function ‘main’:
MemTest.c:24: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’
MemTest.c:39: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’
MemTest.c:24: warning: cast from pointer to integer of different size
MemTest.c:39: warning: cast from pointer to integer of different size

代码中增加下面对应颜色的部分
int i, *intptr=NULL;
intptr = (int *)malloc(sizeof(int)*16);
printf("intptr address: 0x%x\n", (unsigned int)(long)intptr);

时间: 2024-08-05 15:25:53

解决warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’的相关文章

The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments

The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments (String, new   View.OnClickListener(){}) .setNegativeButton("Don't Remind", new OnClickListener() .setNegative

错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)

Fragment newfragment =new MyFragment();fragmentTransaction.replace(R.layout.activity_main,newfragment ).commit(); 提示错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment) 妈蛋,找了好久!一直以

The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the

 The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String) 今天遇到这样一个很奇葩的错误信息,后来查到我导入的包有问题  import android.app.Fragment; import android.app.FragmentManager;   其实我应该使用的

解决"415 Cannot process the message because the content type 'application/x-www-form-urlencoded' was not the expected type 'text/xml; charset=utf-8'"

wcf basicHttpBinding content-type    text/xml;charset=utf-8 wsHttpBinding  'application/soap+xml; charset=utf-8' webHttpBinding 'application/x-www-form-urlencoded'   对应网页中的post请求 所以如果是post请求wcf服务,要使用webHttpBinding 解决"415 Cannot process the message be

解决warning: incompatible implicit declaration of built-in function 'malloc'

由于代码中使用了malloc函数和字符串函数,编译时出现错误 warning: incompatible implicit declaration of built-in function 'malloc' warning: incompatible implicit declaration of built-in function 'bzero' warning: incompatible implicit declaration of built-in function 'strncpy  

解决Warning Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

系统:Ubuntu 16.04 LTS 环境:vscode+java extension pack打开了一个gradle的java项目:另外,用一个terminal启动了groovysh 报错: groovysh报错 java.util.prefs.FileSystemPreferences syncWorld警告: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

The method sort(Comparable[]) in the type Shell is not applicable for the arguments (int[])

看算法第四版的希尔排序时,打算把例中的String数组换成int数组,却出现了上面的问题.最后在StackOverflow找到答案原代码: package sort; import edu.princeton.cs.algs4.In; public class Shell{ public static void sort(Comparable[] a) { //将a[]升序排列 int N = a.length; int h = 1; while (h<N/3) h = 3*h + 1; //

Cannot find an initializer for type &#39;[(String)]&#39; that accepts an argument list of type &#39;(LazyForward

Swift编译错误: Cannot find an initializer for type '[(String)]' that accepts an argument list of type '(LazyForwardCollection<MapCollectionView<Dictionary<Int, String>, Int>>)' 错误代码: var dict = [1: "m", 2: "i", 3: "i

解决js(ajax)提交后端的“ _xsrf&#39; argument missing from POST” 的错误

首先先简述一下CSRF: CSRF是Cross Site Request Forgery的缩写(也缩写为XSRF),直译过来就是跨站请求伪造的意思,也就是在用户会话下对某个CGI做一些GET/POST的事情——这些事情用户未必知道和愿意做,你可以把它想做HTTP会话劫持. 网站是通过cookie来识别用户的,当用户成功进行身份验证之后浏览器就会得到一个标识其身份的cookie,只要不关闭浏览器或者退出登录,以后访问 这个网站会带上这个cookie.如果这期间浏览器被人控制着请求了这个网站的url