码迷,mamicode.com
首页 >  
搜索关键字:ret    ( 30742个结果
【C语言】str类与men库函数的实现(如:strcpy,strcmp,strstr,strcat,memmove,memcpy)
strcpy拷贝源字符串到子字符串,包括‘\0’。代码实现:char*strcpy(char*dst,constchar*src) { assert(src); char*ret=dst; while(*src) { *dst=*src; src++; dst++; } *dst=‘\0‘; returnret; }2.strncpy:strncpy与strcpy之间差别在于,strcpy将源字符串全部拷贝到新的字符串..
分类:编程语言   时间:2016-04-18 15:43:57    阅读次数:283
测试机器的大小端
方法一:#include<stdio.h>intcheck_sys(){inti=1;int*p=&i;char*q=(char*)p;if(*q==1){return0;}else{return1;}}intmain(){intret=check_sys();if(ret==1){printf("big\n");}else{printf("little\n");}return0;}//方法二:利用联合的特点#include<stdio.h>che..
分类:其他好文   时间:2016-04-14 07:02:05    阅读次数:118
【c语言】模拟实现库函数的atof函数
// 模拟实现库函数的atof函数 #include <stdio.h> #include <string.h> #include <assert.h> #include <ctype.h> double my_atof(char const *p) { double ret = 0; int fl ...
分类:编程语言   时间:2016-04-13 12:49:15    阅读次数:192
Python功能之反射
有如下文件:index.py#!/usr/bin/envpython#-*-coding:utf-8-*-__author__=‘ryan‘"""importhomeprint‘oldboy....‘url=raw_input(‘url:‘)ifurl==‘home/dev‘:ret=home.dev()printretifurl==‘/home/index‘:ret=home.index()printretifurl==‘/home/user‘:ret=home.userprintretifurl..
分类:编程语言   时间:2016-04-13 11:30:35    阅读次数:185
数组中单个出现的一个数
#include<stdio.h> intfind(int*p,intlen) { inti=0; intret=0; for(i=0;i<len;i++) { ret^=p[i]; } returnret; } intmain() { intarr[10]={10,3,3,4,4,5,5,6,6}; intlen=sizeof(arr)/sizeof(arr[0]); find(arr,len); printf("%d",find(arr,len)); return0;
分类:编程语言   时间:2016-04-12 07:50:22    阅读次数:165
汇编语言(王爽) 第10章 call和ret
这2个指令也是转移指令,一起用的时候有特效~~~~ 10.1 ret and retf ret 相当于pop ip 把栈顶的字弹出到ip retf相当于先执行pop ip and pop cs 10.2 call 执行2步 1 先把IP或cs和ip推入栈中 2 转移到 标号或内存处 10.3 cal ...
分类:编程语言   时间:2016-04-11 22:15:42    阅读次数:190
memcpy 和 strcpy
memcpy实现 strcpy实现,没有考虑地址重叠 char * strcpy(char *dst,const char *src) //[1]{ assert(dst != NULL && src != NULL); //[2] char *ret = dst; //[3] while ((*d ...
分类:其他好文   时间:2016-04-11 22:13:00    阅读次数:156
[LeetCode] Rising Temperature 上升温度
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates. For example, ret ...
分类:其他好文   时间:2016-04-09 13:45:00    阅读次数:182
汇编中调用函数(类比c
使用call 标号 +ret指令来实现,还可实现嵌套调用 call 标号 : : 标号: : ret ...
分类:其他好文   时间:2016-04-08 14:37:22    阅读次数:125
VC/MFC程序开启关闭其他软件,更改窗口类
流程: 1. 获取目标程序的 窗口HWND hWnd HWND hWnd = ::FindWindowA(_T("SoftWareClassName"),NULL); //获取需要软件的窗口 2. int ret = ::SendMessageA(hWnd ,WM_CLOSE,0,0); //关闭软 ...
分类:编程语言   时间:2016-04-05 12:15:22    阅读次数:236
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!