码迷,mamicode.com
首页 >  
搜索关键字:strlen sizeof    ( 8171个结果
sizeof()中要注意的小问题
chara[]={‘s‘,‘f‘,‘g‘,‘d‘,‘h‘};char*b="sfgdh";charc[]="sfgdh";inta1=‘a‘;chard[6]={‘s‘,‘f‘,‘g‘,‘d‘,‘h‘};printf("%d\n",sizeof(a));printf("%d\n",sizeof(b));printf("%d\n",sizeof(c));printf("%d",sizeof(a1));printf("%d",sizeof(d));结果为:54646--------------------..
分类:其他好文   时间:2014-08-11 18:13:32    阅读次数:171
php 中文字符串翻转
php 自带的字符串翻转函数 strrev() 只支持英文,不支持中文,在网上找到了一个方法,支持中英文: <?php function?reverse($str,?$encode?=?‘UTF-8‘)?{ ????$n?=?mb_strlen($str,?$encode); ????...
分类:Web程序   时间:2014-08-11 15:27:12    阅读次数:231
两种 eratosthenes 筛法的时间比较,第二种快很多会比较好用
#include #include #include #include using namespace std; const int maxn = 10000005; int vis[maxn]; int n; //int eratosthenes() //{ //    memset(vis,0,sizeof(vis)); //    for(int i=2;i ...
分类:其他好文   时间:2014-08-11 15:09:52    阅读次数:214
Codeforces 458A Golden System
比较两个串计算后的大小 主要是q^2=q+1 明显是一个斐波那契数列 100000位肯定超LL 我在每一位只取到两个以内 居然ac了 #include using namespace std; int a[100020]; char s1[100020],s2[100020]; int main() { scanf("%s%s",s1,s2); int len1=strlen(...
分类:其他好文   时间:2014-08-11 12:00:52    阅读次数:274
Keil MDK编译器的数据类型定义
1 #include "usart.h" 2 int main() 3 { 4 USART1_Config(); //串口初始化,以下信息通过串口打印 5 printf("char: %d\r\n",sizeof(char)); 6 printf("unsigned ...
分类:其他好文   时间:2014-08-10 18:32:10    阅读次数:322
C语言中的sizeof中的数组和指针
1.引子 今日在看动态规划的0-1背包问题,看完后还是打算自己写着试试,毕竟实践才能出真知嘛.动态规划的结果是个二维数组dp,我copy书上的例子进行初始 memset(dp,0,sizeof(dp)),考虑到程序的健壮性,对于数组我都是用的动态申请,自然二维数组也不例外[动态二维数组的建立可参见....
分类:编程语言   时间:2014-08-10 10:15:00    阅读次数:253
hdu 1856 more is better
并查集基础#include#include#include#include#include#include#include#define mem(a,b) memset(a,b,sizeof(a))#define ll __int64#define MAXN 1000#define INF 0x7f...
分类:其他好文   时间:2014-08-10 01:40:19    阅读次数:227
Linux内核中常用String库函数实现
//只列举了部分常用的 char *strcpy(char *dest, const char *src) { char *tmp = dest; while ((*dest++ = *src++) != '\0') /* nothing */; return tmp; } char *strncpy(char *dest, const char *src, size_t coun...
分类:系统相关   时间:2014-08-09 23:21:59    阅读次数:524
细节MARK
在刷vijos1046的时候遇到了一些细节,MARK一下1.哲学之前有告诫我说,输出long long的数的时候,最好用cout,不然容易出现编译器的问题,今天算是领教了2.对于数组赋值问题memset(f,63,sizeof(f));这样貌似不会如果是赋const int maxn就需要注意了赋的...
分类:其他好文   时间:2014-08-09 23:12:09    阅读次数:201
50.编写程序,逆转字符串
?//1、运用到strlen函数取得输入字符串的长度//2、输出时注意数组下标#include#includeusing namespace std;int main(){ int temp; char a[20]; cout>a; temp=strlen(a); fo...
分类:其他好文   时间:2014-08-09 18:12:18    阅读次数:235
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!