学习日志0717

学习日志 姓名:  王森 日期: 07.17

 

 

 

 

今日学习任务

 

  1. 指针的意义、作用、字节长度;
  2. * &运算符的作用(对应的内存空间和指向的内存空间)
  3. 多维指针的作用
  4. 野指针、如何避免野指针
  5. 函数的基本语法和程序框架

日任务完成情况

 

(详细说明本日任务是否按计划完成,开发的代码量)

  1. 指针的意义、作用、字节长度;
  2. * &运算符的作用(对应的内存空间和指向的内存空间)
  3. 多维指针的作用

4、野指针、如何避免野指针

5、函数的基本语法和程序框架

日开发中出现的问题汇总

 

自己个人未能熟练掌握C语言的学习,可能在编写程序与代码阅读中存在一些问题。由于时间安排出现偏差所以学习任务也与之间预计的发生偏差

 

 

日未解决问题

 

日开发收获

自己上个学期曾经复习过C语言,但是看书与实践差很远,趁此机会能够再捡起C语言很开心,可以让大学的学习连贯起来

 

自我评

 

(是否按开发规范完成既定任务,需要改进的地方,与他人合作效果等)

 

 

基本能够跟上老师的教学进度,其中一些需要记忆的东西有点多,需要加深记忆。还有要回顾以前所学习的知识,将所学知识综合起来。

其他

 

 

 

 

 

 

 

代码如下:

#include<stdio.h>

 

int main()

{

    int *a;

    double *b;

    char *c;

    long *d;

    short *e;

 

    printf("the bits of int is: %d\n", sizeof( *a ));

    printf("the bits of double is: %d\n",sizeof( *b ));

    printf("the bits of char is: %d\n", sizeof( *c ));

    printf("the bits of long is: %d\n", sizeof( *d ));

    

    return 0;

}

 

 

 

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#define  MAX_LEN   sizeof(char) * 50

 

int main()

{

    char *ptr = ( char *) malloc ( MAX_LEN );

    char *temp = ptr;

 

    if( ptr == NULL )

    {

        printf(" malloc error ! \n");

exit(1);

    }

 

    memset(ptr , 0 , MAX_LEN );

 

    scanf("%s",ptr);

    

    while( *temp != '\0')

    {

        printf("%c\n", *temp);

temp ++;

    }

 

    free(ptr);

 

    ptr = NULL;

    

    return 0;

}

 

 

 

 

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#define MAX_LEN sizeof( char ) * 50

 

int main()

{

    int i;

    int len = 0;

    int max = 0;

    char *ptr = ( char* ) malloc (MAX_LEN);

    char *temp = ptr;

    char *str = ( char* ) malloc (MAX_LEN);

    char *s_temp = str;

 

    if( ptr == NULL )

    {

        printf(" malloc error! \n");

exit(1);

    }

 

    memset( ptr , 0 , MAX_LEN );

     

    printf("please input the num:\n");

    scanf("%s", ptr);

 

    while( *temp != '\0')

    {

        

while( *temp >= '0' && *temp <= '9')

{

    len++;

    temp++;

        }

        if( max < len )

{

    max = len ;

    {

        for( i = 0 ; i < max ; i++)

{

    *( s_temp + i) = *( ptr + i);

}

*( s_temp + i) = '\0';

        //printf("the copy is : %s\n  ", s_temp);

    }

}

 

len = 0;

 

temp++;

 

    }

    printf("the max is: %d\n",max);

    printf("the copy is : %s\n  ", s_temp);

    free( ptr );

 

    ptr = NULL;

 

    return 0;

}

 

 

 

#include<stdio.h>

 

 

 

int main()

{

    int num;

 

    printf("please input the num: \n");

    scanf("%d",num);

    

    count_9( num );

 

    printf("1-%d count_9 = %d\n", num , result);

 

    return 0;

}

 

 

 

#include<stdio.h>

 

void swtich( int a , int b )

{

    int temp;

  

    temp = a ;

    a = b ;

    b = temp ;

 

}

 

 

int main()

{

    int a;

    int b;

 

    printf(" please input a : \n");

    scanf("%d",&a);

    printf(" please input b : \n");

    scanf("%d",&b);

 

    swtich(a,b);

    printf("a = %d , b = %d \n", a ,b);

    

    return 0;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值