C 学习笔记

本文详细探讨了编程的基础知识与高级技术,包括数据结构、算法、开发工具、测试、运维等核心领域,旨在为程序员提供全面的技术指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Perfect Code Can Say Anything

-----------------------------------------------------------------------------------------------------------------

eg1:

int array[10]={9}  array=9 0 0 0 0 0 0 0 0 0 

int array[0]={0} array=0 0 0 0 0 0 0 0 0 0

++array[0]  =>  get the array[0] number and increase. and result array[0] value is 1

----------------------------------------------------------------------------------------------------------------

eg2.

//count the number's times

  int c=0

  int array[10];

  while((c=getchar())!=EOF){

    if(c>='0'&&c<='9')

    {

    ++array[c-'0'] ;

    }

    }  

"hello\n"  --------->h    e   l    l   o    \n    \0

-----------------------------------------------------------------------------------------------

eg3

int getline(char s[],lim)

for(i=0;i<lim-1&&(c=getchar())!=EOF&&c!='\n';i++)

{s[i]=c;}

if(c=='\n') s[i]=c

 -----------------------------------------------------------------------------

void copy(char to[] ,char from[])

{

int i=0;

while((to[i]=from[i])!='\0'){

i++;

}

}

 ---------------------------------------------------------------------------------

 

 int *pa  

int a[10]

a[1] is diffreent from a  ====>a[1] is a int number and a is a pointer

a is a pointer so   pa=a    equal pa=&a[0]    and a[i] equal   *(a+i)

a[0] equal  *pa      ====>a[i]  equal  pa[i]

char *s equal char s[]

-------------------------------------------------------------------------------------

char amessage[]="Hello C"         can be modified    it's an array

char *amessage="Hello C"         can't  be modified  string const

 

转载于:https://www.cnblogs.com/epirus/archive/2012/12/21/2827871.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值