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对事件进行监听,当事件发生后进行一 ...
随机推荐
- 关于迭代器中IEnumerable与IEnumerator的区别
首先是IEnumerable与IEnumerator的定义: 1.IEnumerable接口允许使用foreach循环,包含GetEnumerator()方法,可以迭代集合中的项. 2.IEnumer ...
- csharp: WebBrowser read baidumap
setpoint.html: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Typ ...
- UGUI之布局的使用
unity的LayoutGroup分为三种, Horizontal Layout Group(水平布局):对象填充总个父物体,水平会填充 Vertical Layout Group(垂直布局):垂直( ...
- JVM的ClassLoader过程分析
本文来自网络:深入分析Java ClassLoader原理 http://my.oschina.net/zhengjian/blog/133836 一. JVM的ClassLoader过程以及装载原理 ...
- 【GOF23设计模式】外观模式
来源:http://www.bjsxt.com/ 一.[GOF23设计模式]_外观模式.公司注册流程.迪米特法则 package com.test.facade; public interface 工 ...
- uml入门之14图与图之间的关系
1.先奉上整理的14图. 2.其次奉上整理的图之间的6种关系
- Upgrade custom workflow in SharePoint
Experience comes when you give a try or do something, I worked in to many SharePoint development pro ...
- WebActivatorEx 注入时的使用
WebActivator类库提供了3种功能,允许分别在Application_Start初始化之前,之后以及ShutDown的时候,分别执行指定的代码,并且允许多次指定.示例如下: [assembly ...
- 转:EClipse 10个最有用的快捷键
Eclipse快捷键 10个最有用的快捷键 Eclipse中10个最有用的快捷键组合 一个Eclipse骨灰级开发者总结了他认为最有用但又不太为人所知的快捷键组合.通过这些组合可以更加容易的浏览源代 ...
- 编译iOS程序时的-all_load选项,以及-all_load 导致的 ld duplicate symbol xx的问题
在新的SDK环境中调试百度地图的应用程序时,app总是意外退出,找了半天发现错误的原因是unrecognized selector xx的错误,另外还有报了一个Unknown class XXX in ...