Learning c section 1
#include<stdio.h> void main()
{
puts("hello world");
int x=4;
//the %p format will print out the location in hex(base lb) format
printf("x lives at %p\n",&x);
int * addr_of_x = &x;
printf("x lives at %p\n",addr_of_x);
printf("the content of addr_of_x is %d\n",*addr_of_x); printf("the size of int is %d\n",sizeof(int));
char quote[]="turtles!";
// this will return 9, which is 8 characters plus the \0 end character
printf("the size of int is %d\n",sizeof(quote));
//why pointers have types?
/**
different data types has different size, when you do pointer arithmetic,
the compiler will not know how to increce the value when you not specify
the concrete data type of the pointer.
**/
int doses[] = {1, 3, 2, 1000};
printf("Issue dose %i\n", 3[doses]);
/*
char name[40];
printf("Enter your name: ");
scanf("%39s",name);
printf("your name is :%s\n",name);
int age;
printf("Enter your age: ");
scanf("%i\n", &age);
printf("your age is :%i\n",age);
//be careful with this , if your input is bigger than your variable to hold it.
//it will cause buffer overflows
char food[5];
printf("Enter favorite food: ");
fgets(food, sizeof(food), stdin);
printf("your favorite food is :%s\n",food);
*/
char *cards="JQK";
//string literals can never be updated
//the following code will cause one error,
//but it will pass compile
//why cause this? the string literals will store one read only memory.
//these constants will be used all threads, so can not changed.
//cards[1]='K';
puts(cards);
printf("address of the cards is :%p\n",cards);
printf("address of the string JQK is :%p\n",&"JQK");
char cards2[]="JQK";
puts(cards2);
printf("address of the cards is :%p\n",cards2); }
refer: head first C
Learning c section 1的更多相关文章
- (转) Ensemble Methods for Deep Learning Neural Networks to Reduce Variance and Improve Performance
Ensemble Methods for Deep Learning Neural Networks to Reduce Variance and Improve Performance 2018-1 ...
- (转)Understanding, generalisation, and transfer learning in deep neural networks
Understanding, generalisation, and transfer learning in deep neural networks FEBRUARY 27, 2017 Thi ...
- opencv7-ml之svm
因为<opencv_tutorial>这部分只有两个例子,就先暂时介绍两个例子好了,在refman中ml板块有:统计模型.普通的贝叶斯分类器.KNN.SVM.决策树.boosting.随机 ...
- Support Vector Machines for classification
Support Vector Machines for classification To whet your appetite for support vector machines, here’s ...
- OpenCV支持向量机(SVM)介绍
支持向量机(SVM)介绍 目标 本文档尝试解答如下问题: 如何使用OpenCV函数 CvSVM::train 训练一个SVM分类器, 以及用 CvSVM::predict 测试训练结果. 什么是支持向 ...
- [DOM Event Learning] Section 4 事件分发和DOM事件流
[DOM Event Learning] Section 4 事件分发和DOM事件流 事件分发机制: event dispatch mechanism. 事件流(event flow)描述了事件对象在 ...
- [DOM Event Learning] Section 3 jQuery事件处理基础 on(), off()和one()方法使用
[DOM Event Learning] Section 3 jQuery事件处理基础 on(),off()和one()方法使用 jQuery提供了简单的方法来向选择器(对应页面上的元素)绑定事件 ...
- [DOM Event Learning] Section 2 概念梳理 什么是事件 DOM Event
[DOM Event Learning] Section 2 概念梳理 什么是事件 DOM Event 事件 事件(Event)是用来通知代码,一些有趣的事情发生了. 每一个Event都会被一个E ...
- [DOM Event Learning] Section 1 DOM Event 处理器绑定的几种方法
[DOM Event Learning] Section 1 DOM Event处理器绑定的几种方法 网页中经常需要处理各种事件,通常的做法是绑定listener对事件进行监听,当事件发生后进行一 ...
随机推荐
- BI之SSAS完整实战教程3 -- 创建第一个多维数据集
上一篇我们已经完成了数据源的准备工作,现在我们就开始动手,创建第一个多维数据集(Cube). 文章提纲 使用多维数据集向导创建多维数据集 总结Cube设计器简介 维度细化 总结 一.使用向导创建多维数 ...
- VS "15" 预览 5 中 VB 15 新增的功能
VS "15" 预览 5 给 VB 带来了更新.这次的更新内容有3个: * 值元组 ValueTuple这个功能能把一组计算结果成组返回.为了使用这个功能,我们要安装 System ...
- Jquery的画图插件-jqPlot+
JqPlot(个人和商业都免费) http://yunpan.cn/Q7Yh5dUNPjtak 提取码 3653 下面开始制作一个柱状图: ----------------------------我 ...
- [moka同学笔记]yii2场景的使用(摘录)
前半部分为自己使用的过程,下边为转载的,具体地址见:http://blog.sina.com.cn/s/blog_88a65c1b0101j717.html 1.在model中 public func ...
- Hibernate框架之入门
1.Hibernate框架简述 Hibernate的核心组件在基于MVC设计模式的JAVA WEB应用中,Hibernate可以作为模型层/数据访问层.它通过配置文件(hibernate.proper ...
- 布局文件预览:Rendering Problems Exception raised during rendering: Unable to find the layout for Action Bar.的解决
在android studio或者eclipse中打开layout文件,发现不能预览布局,提示以下错误: Rendering Problems Exception raised during rend ...
- 关于setInterval和setTImeout中的this指向问题
前些天在练习写一个小例子的时候用到了定时器,发现在setInterval和setTimeout中传入函数时,函数中的this会指向window对象,如下例: var num = 0; function ...
- javascript作用域链学习笔记
作用域链 "JavaScript中的函数运行在它们被定义的作用域里,而不是它们被执行的作用域里." --权威指南 在JavaScript中,一切皆对象,包括函数.函数对象和其它对象 ...
- 刚刚结束了公司EP流程,开始KMS项目开发了
刚刚结束了公司EP流程,开始KMS项目开发了 EP流程:AGpoint+MOSS+C# KMS:MOSS上的文档管理系统
- App开发流程之通用宏定义及头文件
工欲善其事,必先利其器. 在正式实现各种炫酷的功能和UI前,做好准备工作是提高后续开发效率的必经之路. 所以,这个系列,我不是在各种堆技术,更关注的是“兵马动”之前的“粮草行”,有些繁琐,但当清晰理出 ...