小编Sha*_*ahb的帖子

EXC_BAD_ACCESS(代码2,地址= .....)

我是C编程的新手,并尝试运行一个简单的程序,它将字符串t放在字符串s的末尾:

#include <stdio.h>

void _strcat(char *s, char *t){
    for(;*s;s++);
    for(;(*s=*t)!='\0';s++,t++);

}

int main()
{
    char *s="hello";
    char *t="how are you?";

    _strcat(s,t);

    getchar();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

但是我经常会因为分配两个指针(相同类型)而产生一个恼人的错误,*s=*t; 这就是错误:

线程1:EXC_BAD_ACCESS(代码2,地址= .....)

c

1
推荐指数
1
解决办法
3556
查看次数

比较c ++中的int和bitset

如何将bitset与整数进行比较?或者更一般地使用整数运算符:类似这样的事情:

#include <iostream> 
#include <iomanip>
#include <bitset>
using namespace std;

int main()
{
bitset<4> _b1 = 3 ; 


if(_b1>=2 )
    cout<<_b1;



system("pause");
return 0;
Run Code Online (Sandbox Code Playgroud)

}

c++ bitset

0
推荐指数
1
解决办法
1111
查看次数

标签 统计

bitset ×1

c ×1

c++ ×1