C/C++:a&1 and a%2 problem

本文通过一个简单的C语言程序示例介绍了如何使用位运算符进行按位与操作,并展示了如何将整数转换为字符输出。该程序首先定义了一个整型变量a并赋值为11,接着使用了按位与运算符对a进行操作,并将结果转换成字符形式打印输出。
int a = 11;
char b = '0' + a%2;
char c = '0' + a&1;
printf("(%c) (%c) (%d)\n",b,c,c);
return 0;

此时输出:
(1) () (1)

此时&运算符解释为按位与,没有+优先级高。

raw_file.c "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\anaconda3\libs /LIBPATH:D:\anaconda3 /LIBPATH:D:\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.26100.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.26100.0\\um\x64" c.lib /EXPORT:PyInit__hdf5maker build\temp.win-amd64-cpython-313\Release\src\hdf5maker.obj build\temp.win-amd64-cpython-313\Release\src\raw_file.obj /OUT:build\lib.win-amd64-cpython-313\_hdf5maker.cp313-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-313\Release\src\_hdf5maker.cp313-win_amd64.lib LINK : fatal error LNK1181: 无法打开输入文件“c.lib” error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX86\\x64\\link.exe' failed with exit code 1181 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for hdf5maker Running setup.py clean for hdf5maker Failed to build hdf5maker error: failed-wheel-build-for-install × Failed to build installable wheels for some pyproject.toml based projects ╰─> hdf5maker
最新发布
08-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值