C++ 基础学习整理II

C++ 基础学习整理I

stef posted @ 2011年7月05日 21:07 in cpp , 1916 阅读

switch后面括号中的表达式 只能是整形、字符型或枚举类型表达式。

一个程序将操作系统非配给内存四个区域:
1. 代码区,存放程序的代码,即程序中的各个函数代码块
2. 全局数据区,存放程序的全局数据和静态数据
3. 堆区,存放程序的动态数据
4. 栈区,存放程序的局部数据,即各个函数中的数据

全局变量定义之前的函数 不知道该变量。

局部变量前面加auto,可以省略,一般不写。

如果局部变量不被显示初始化,那么,其内容是不可预料的。

内联函数 在函数前定义inline,主要是为了节省效率,被生成为内联的函数,编译器看到后会自动为其创建一段代码。

内联函数中,不能含有复杂的结构控制语句,如switch和while。如果内联函数有这些语句,则编译将该函数视同普通函数那样产生函数调用代码。
另外,递归函数(自己调用自己的函数)是不能被用来做内联函数的。
内联函数只适合只有1-5行的小函数。对一个含有许多语句的大函数,函数调用和返回的开销相对来说微不足道,所以也没有必要用内联函数实现。

typedef定义的类型只能使之相同于一个已存在的类型,而不能建立新的类型。


默认参数在函数声明中提供,当又有声明又有定义时,定义中不允许默认参数。

如果一个函数中有多个默认参数,则形参分布中,默认参数应从右至左逐渐定义。

extern的变量说明是变量声明,而不是变量定义。

静态全局变量对组成改程序的其他源文件是无效的。

函数的声明和定义默认情况下在整个程序中是extern的。有时候,你可能需要使某个函数只在一个源文件中有效,不能被其他源文件所用,这是在函数前面加上static。

如果被隐藏的是全局变量,则可用符号::来引用该全局变量。

不能用变量来描述数组定义中的元素个数。

局部数组arrl[5]根据初始化表值的内容按序初始化,由于初始化表值只有1个,所以还有4个元素的值为不确定。在这里均为23567。

这里不要忘记为最后的'\0'分配空间。如果要初始化一个字符串"hello",那为它定义的数组至少有6个数组元素。

对于字符串的初始化,要注意数组实际分配的空间大小是字符串中字符个数加上末尾的'\0'结束符。

在定义数组的场合,无论如何,编译器必须知道数组的大小。

无论何时,将数组作为参数传给函数,实际上只是把数组的地址传给函数。

起始地址。由于数组参数是地址,对数组参数不能通过sizeof求得数组大小,所以sum()函数必须要第二个参数:数组的大小。

基本来自钱能《C++程序设计教程》……

Avatar_small
Professional assignm 说:
2018年1月16日 20:04

C++ also represents the teaching of OOP basics, getting to understand the concept is the first part of any thing in learning and the how to express it in written form is what follows.Before C++ one has to go through basic C also.

Avatar_small
Help With Essay 说:
2018年2月12日 23:42

basic are the foundation of programming. If your basics aren't clear please i recommend don't proceed onwards unless your basics are crystal clear to you.

Avatar_small
topics for presentat 说:
2018年2月15日 00:49

It is the information I am looking for. I'm learning more about this. Hope you bring more things related to it. Thank you very much!

Avatar_small
topics for presentat 说:
2018年2月15日 00:49

It is the information I am looking for. I'm learning more about this. Hope you bring more things related to it. Thank you very much!

Avatar_small
write my assignment 说:
2018年2月15日 00:51

Great informative site. I'm really impressed after reading this blog post. I really appreciate the time and effort you spend to share this with us! I do hope to read more updates from you.

Avatar_small
ninjaessays discount 说:
2018年3月04日 07:54

A friend of mine was asking me recently on how this computer and C++ thing worked i told him to look for this article because even though it's in Chinese some of the translations have greater knowledge in them than usual textbooks for this topic

Avatar_small
Assignment help 说:
2018年3月18日 18:29

Visit our website to get best assignment help for your academics.

Avatar_small
Assignment Help Serv 说:
2018年3月22日 01:23

Functions are only appropriate for small purposes. For a great occupation with numerous declarations, the above of purpose calls and revenues is comparatively trivial.

Avatar_small
UK Essay Help 说:
2018年4月12日 06:17

Awesome post I might want to thank you for the endeavors you have made in composing this intriguing and proficient article.

Avatar_small
Allassignmenthelp re 说:
2018年4月30日 18:28

Visit us to know the reviews of different assignment writing service providers.

Avatar_small
fullassignmenthelp 说:
2018年5月23日 21:07

All Programming languages are same you can learn them but C++ is a basic and the backbone of all languages in the programming world I prefer mostly to work on C++.

Avatar_small
pandaexpress feedbac 说:
2018年7月11日 20:40

Panda Express is a fast-casual restaurant chain. And it is the largest Asian segment restaurant chain in the United States. This Panda Express restaurants were traditionally located in shopping mall food courts.

Avatar_small
ludo king 说:
2018年7月18日 14:40

I have been seeking information on this topic for the past few hours and found your post to be well written and has solid information. Thank you!

Avatar_small
Dissertation Writing 说:
2018年7月29日 18:35

John Arnold Is An Academic Writer Of The Dissertation-Guidance. Who Writes Quality Academic Papers For Students To Help Them In Accomplishing Their Goals.

Avatar_small
PHP programming Help 说:
2018年7月29日 20:47

This Is Really A Great Stuff For Sharing. Keep It Up .Thanks For Sharing.

Avatar_small
talktowendys 说:
2018年9月30日 06:31

<a href=" https://customersurvey.club/www-talktowendys-com/"> talktowendys </a>
<a href=" https://customersurvey.club/www-talktowendys-com/"> www.talktowendys.com </a>
Wendy’s is an American International fast food restaurant chain and it is the world’s third largest hamburger fast food chain.

Avatar_small
usps tracking 说:
2018年10月15日 16:41

Your blog is meaningful, I have read many other blogs but your blog has persuaded me, I hope in the coming time you will have more great blogs to share with readers.

Avatar_small
njmcdirect 说:
2018年11月08日 22:34

Sometimes we make mistakes accidentally, even though it has happened accidentally we need to pay for that.

Avatar_small
<a href="http://www. 说:
2018年11月27日 23:30

The model analysis is usually considered a stable state computation based on a given scheme operating point, and assuming the scheme is linear around that operating point.

 

Avatar_small
the impossible quiz 说:
2018年12月06日 22:03

Thank for your writer! I have read through some similar topics! However, your post has given me a very special impression, unlike other posts. I hope you continue to have valuable articles like this or more to share with everyone!

Avatar_small
Restaurant Auctions 说:
2019年3月14日 20:27

Auction Factory is the best place to get the best online Auctions we have the most updated auctions you can get the best business help with us we can sure you that we have the best online marketing help so you can get the most effective buyers with us and also we give help to the buyers to get the best equipment with us we are managing Resturant Auction see our current Auction today.

Avatar_small
Restaurant Auctions 说:
2019年3月14日 20:29

Tropical Smoothie Cafe and Sam's Donut Hole Equipment
196 Crawford Rd., Statesville, NC 28677

Avatar_small
Kitchen Furniture St 说:
2019年3月14日 23:01

Get the best discount rate furniture with us we have the nice number one quality furniture you can have the best way to design your room with us if you want to get any help you can contact to us we can provide you with the best furniture for your bedroom, dining room and many more as you need for home and office.

Avatar_small
basement Ohio 说:
2019年3月14日 23:50

You can get foundation settling we have the best solutions of the water problems if you think that no one can handle it then no need to worry we are here we can do any work easily with the experts we have 10+ working experience in the Basement problems you can just tell us your budget we can make it done within your budget with our experts.

Avatar_small
google.com 说:
2019年4月10日 03:41

Advertising is your main tool to have the business ready to go. Actually, everybody is busy in their company marketing over the World Wide Web. Unfortunately, online company is scammed with scammers. On occasion the provider hires you freelance, or occasionally it is a site designer which orders the copy <a href="http://google.com/">google</a> At an identical time, if you decide on the most suitable company having excellent reviews and reputation, you will enjoy well composed works. http://google.com/

Avatar_small
99 logo design 说:
2019年4月16日 00:59

Take the best logo design service with us in the USA we have the best experts to provide you with the best online auctions help in the UK to you we have the best designers and developers in our software house you can take the service with them for your brand development and designing with us we have the best experts here for your service.

Avatar_small
99 logo design 说:
2019年4月16日 01:00

Take the best logo design service with us in the USA we have the best experts to provide you with the best online auctions help in the UK to you we have the best designers and developers in our software house you can take the service with them for your brand development and designing with us we have the best experts here for your service.

Avatar_small
webnovel 说:
2019年7月07日 17:23

Thanks for your post. I’ve been thinking about writing a very comparable post over the last couple of weeks, I’ll probably keep it short and sweet and link to this instead if thats cool. Thanks.

Avatar_small
dinobids 说:
2019年8月28日 22:02

You can get the best service with us here https://dinobids.com/ we have the best auctions of the equipment and the school equipment auctions you can get the best service with us for the best-used equipment auctions in the USA.

Avatar_small
jessivagoldner 说:
2019年9月24日 20:52

It's a great idea for my next post for https://dissertationmasters.com/discussion.html. Usually, I ideas for my posts but now it's a time when I feel exhausted. Thanks for posting this.

Avatar_small
assignmentcorp.co.uk 说:
2019年11月14日 20:39

You can get the best Assignment and Article writing service in the UK. With us, we have the best experts to provide you with the best on-time service and with the best step by step guideline so you can get the best help with us in the UK. You can follow us for any query we can provide you with the best solutions for your writing-related worries.

Avatar_small
dris2 说:
2019年11月24日 15:40

The road of love was only by himself so he had to step If love is only on the lips, I do not need you to say Hey dear, I still remember or have forgotten The places I vowed and the places I used to go We used to experience and taste the night together So how is the moon with the sun? How you, how you, how you

krunker

 

super smash flash 2

Avatar_small
upserscom 说:
2019年11月24日 22:07

United Parcel Service is a logistics and package delivery business. Its logistics services include the passage, distribution, contract logistics.

Avatar_small
Quality Essay Help 说:
2019年12月09日 03:20

Hello, I would like to thank you for sharing this interesting information. Moreover, the material provided here will be useful for a lot of people. thanks a lot.

Avatar_small
316 stainless steel 说:
2020年1月27日 01:59

Thanks for the auspicious writeup. It in truth used to be a leisure account it. Glance complex to more delivered agreeable from you! However, how can we keep up a correspondence?

Avatar_small
Sofia Martin 说:
2020年2月18日 00:07

This is extraordinary blog. I like the way wherein it is formed. These sorts of web diaries should be propelled all together <a href="https://www.spsshelp.co.uk">spss help</a>

Avatar_small
Free Download PLAYit 说:
2020年4月15日 20:54

thanks for nice article . this post is very useful

Avatar_small
Mad Max Jacket 说:
2021年2月20日 04:22

Thanks for the nice blog. It was very useful for me. I'm happy I found this blog.

Avatar_small
Gerard Butler Shearl 说:
2021年11月15日 04:17

Thank you for sharing such a useful information here in the blog.

Avatar_small
99logodesign 说:
2021年11月22日 08:07

If you are looking for a program in which you can display your talent in front of others who can respect your creativity so here we are giving you a golden chance to fresh faces be a part of this program. This Logo design contest program will be held in the upcoming week to tight up the seatbelt with your talent, details related to the program are provided on our official website so without wasting further time enroll yourself in this program. Don’t miss this spectacular opportunity. This program will help you to boost up your confidences level and enhance your skills, this program may open doors that may lead you towards success. Through this contest, we will learn some new tricks which will help you in your work and make it easy for you. Judges of this program are much-known artists, who will give you remarks on your work, so just show your potential and determination towards your work which may lead you to some golden opportunities.

Avatar_small
Vitamin Deck 说:
2021年12月06日 02:48

Biotin is the supplement which also for beauty and I want for myself, then I go through the website named https://www.vitamindeck.com.pk/ . They really have a large range of imported biotin

Enable GingerCannot connect to Ginger Check your internet connection
or reload the browserDisable in this text fieldRephraseRephrase current sentenceEdit in Ginger×

Avatar_small
Yellowstone S04 Mo B 说:
2022年1月12日 05:36

Pretty cool post. It’s really very nice and useful post. Keep it up!!

Avatar_small
Fur Collar Beth Dutt 说:
2022年1月22日 05:10

very much advanced my understanding to the next top level. Great job and continue to do same.

Avatar_small
Beautyfly 说:
2022年3月09日 20:18

Are you looking for products that are essential to add to your skin routine? CeraVe is a famous brand originated in the USA that manufactures significant products that efficiently cleanses, moisturizes, and exfoliates your delicate skin for more soother and clear skin. The <a href="https://beautyfly.pk/brands/cerave/">CeraVe products in Pakistan</a> are formulated with essential ceramides that restore skin barriers and help in retaining moisture and hydration. You can vitally seek your desired CeraVe product in Pakistan at beautyfly, procured directly from the USA for authenticity and quality of the product.

Avatar_small
Black Denim Vest Jui 说:
2022年6月02日 03:10

I am so happy to come across this piece of write up, very much advanced my understanding to the next top level. Great job and continue to do same.

Avatar_small
breaking news desk 说:
2022年7月01日 01:49

You never know what the day will bring, but one thing is for sure: you will need the breaking news desk to help you stay on top of it all. Whether you are a local, national, or international news producer, you need a news desk that can accommodate any breaking news event.

Avatar_small
Steve McQueen Gulf J 说:
2022年9月05日 20:52

Very nice article I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!.

Avatar_small
Mark Wahlberg Me Tim 说:
2022年9月19日 19:36

This is a great article and great read for me. It's my first visit to your blog.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter