码迷,mamicode.com
首页 >  
搜索关键字:printf    ( 15030个结果
螺旋数字程序
#include<stdio.h> intmain(intargc,constchar*argv[]) { intnum,maxnum,count=1,x=0,y,numtemp; inti; printf("输入螺旋列数num,和最大数字maxnum\n"); scanf("%d%d",&num,&maxnum); intindex[10][10]={0}; numtemp=num; y=num-1; while(count<=maxnum){ f..
分类:其他好文   时间:2014-09-11 02:25:02    阅读次数:171
STM32F051关于printf函数在串口打印中的使用
1、需要在Options for Target -> Code Generation 中勾选Use MicroLIB;2、需要加入下面这个函数:int fputc(int ch, FILE *f){USART_SendData(USART1,(uint8_t)ch);while (USART_Get...
分类:其他好文   时间:2014-09-10 20:57:10    阅读次数:219
ping hosts文件各个配置项
#!/bin/bash #pingall cat /etc/hosts | grep -v ‘^$‘ | grep -v ‘^#‘ | while read IP DOMAINS do for DOMAIN in $DOMAINS do ping -c1 $DOMAIN > /dev/null 2>&1 #echo $DOMAIN "("$IP")" "["$?"]" printf "%-5...
分类:其他好文   时间:2014-09-10 17:57:41    阅读次数:171
linux应用编程之线程编程
1 线程创建 #include #include #include void thread(void) { int i; for(i=0;i<3;i++) { printf("this is a pthread\n"); } } int main(void) { pthread_t id; int i,ret; ret = pthread_create(&id,N...
分类:编程语言   时间:2014-09-10 17:49:00    阅读次数:276
gcc -static hello.c 背后究竟发生了什么
大家可能经常使用gcc -static ***.c,那么这个静态链接究竟使用了什么命令,又链接了哪些库呢?    我们首先来分析libc.a是个什么文件。我们已经知道了xxx.so是动态链接库,xxx.o是静态链接库或者说可重定位文件,/bin/bash为可执行文件。    libc.a其实是很多可重定位文件的集合,而且每个可重定位文件中一般都只写一个函数。例如printf.o只有printf一个...
分类:其他好文   时间:2014-09-10 17:45:40    阅读次数:236
C语言中的调试宏
#ifdef DEBUG #define debug_printf(fmt, ...) printf(fmt, ##__VA_ARGS__) #else #define debug_printf(fmt, ...) #endif 其中##在没有参数的时候去掉前面的","号,否则在没有参数的时候,编译会报错。 #include #ifdef DEBUG #define debug_prin...
分类:编程语言   时间:2014-09-10 14:17:00    阅读次数:200
C语言输出格式总结
转自:http://www.cnblogs.com/scbzljstudy/archive/2011/02/28/1966887.html1 一般格式printf(格式控制,输出表列)例如:printf("i=%d,ch=%c\n",i,ch);说明:(1)“格式控制”是用双撇号括起来的字符串,也称...
分类:编程语言   时间:2014-09-10 12:17:40    阅读次数:259
C语言位取反问题
1 具体是先把十进制的数先转换成二进制的原码, 按位取反最后一位加一,然后“按权展开”,得到十进制的结果, 如果第一位是1(指转换成二进制的原码中的第一位),说明故是负数所以要在结果前面加上负号-。 例子: int x=20; printf("%d\n",~x); 结果是 -21 求解过程:x=.....
分类:编程语言   时间:2014-09-09 18:15:09    阅读次数:266
C语言取反运算~
问题:printf("%x,%d\n",~7,~7);解:十进制数字7的二进制码00000000000000000000000000000111按位取反运算~711111111111111111111111111111000所以printf("%x\n",~7);//十六进制输出:fffffff811111111111111111111111111111000的最高八位符号位(11111111,表示负数),有符号整..
分类:编程语言   时间:2014-09-09 13:50:59    阅读次数:231
C语言 去掉字符串最后的 *
#include<stdio.h>#include<conio.h>voidproc(char*str){while(*str!=‘\0‘)str++;//将指针移到最后一位str--;while(*str==‘*‘)str--;*(str+1)=‘\0‘;//添加结束符}voidmain(){chars[17]={"****asd***fff***"};puts(s);printf("\n");proc(s);puts(s);}
分类:编程语言   时间:2014-09-09 13:50:39    阅读次数:263
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!