4
22
2014
23

关于char *用法

关于一下

char * pChar;

if(NULL==(pChar=(char *)malloc(siziof(char)*200)))printf("malloc error\n")

memset((void*)pChar,0,200);//把200个字节内容清零

print("pChar[0]=%c",pChar[0]);

i=(pChar[0]==0;)printf("~~~%ld\n",i);

pChar[0]=1;

print("pChar[0]=%c",pChar[0]);

i=(pChar[0]==0;)printf("~~~%ld\n",i);

pChar[0]=48;

print("pChar[0]=%c",pChar[0]);

i=(pChar[0]==0;)printf("~~~%ld\n",i);

其实*pChar的内容置0,其实就是置为串尾符。

执行结果是:

由上面的结果也可以看出pChar=0其实是赋值NULL。清空

pChar=0,或者pChar=1,进行时直接的acsii值表的赋值。直接查国际Ascii表就可以知道结果了。比如数字0对应的ascii表值为48,则:

print("pChar[0]=%c",pChar[0]);的结果和ASCII码表相对应。故pChar[0]=48;则print("pChar[0]=%c",pChar[0]);打印的结果pChar[0]=0

 

 

故可以有如下操作

...

i=**;

if(pChar[i]==0)pChar[i]=1;

...

即虽然pChar[i]为char类型,但是可以直接赋值0,1.即按照ACSII码表来赋值

Category: 编程理解 | Tags: | Read Count: 2441
Avatar_small
Maha 11th Model Pape 说:
2022年8月22日 02:59

Every year, this board administers the 11th grade test, and the Maha 11th Important Question Paper for this examination will soon be available on the Maharashtra Board's official website. Around 15 lakh students took part in the Maharashtra Board Class 11th examinations, which were likewise held in the month of February starting in March 2023. Maha 11th Model Paper 2023 The Maharashtra Board Class 11th Important Question Paper 2023 was released in the month of May 2023. According to a poll, Maharashtra 11th Important Question Paper 2023 is expected to be released in May of this year as well. We advise all students to be patient and wait for the release of the Important Question Paper 2023.

Avatar_small
civaget 说:
2023年12月03日 03:32

Say hello to 백링크하이 and wave goodbye to spammy links. They've boosted my website's credibility.

Avatar_small
SEO 说:
2023年12月03日 16:24

Toto Match's 100x fraud compensation is reassuring for 토토사이트 users.

Avatar_small
civaget 说:
2023年12月07日 19:14

Ready to explore Korea's best-kept secrets? 오피뷰 leads the way. OPMoa's expertise ensures you're always informed.

Avatar_small
civaget 说:
2023年12月09日 21:12

I've been playing at 안전카지노 for months, and their commitment to safety is commendable. No worries about fraud here.

Avatar_small
civaget 说:
2023年12月10日 22:10

제주출장마사지 brings tranquility to your doorstep. Don't miss the chance to experience their top-notch massage services on Jeju Island.

Avatar_small
civaget 说:
2023年12月10日 22:32

When in Busan, make sure to experience 부산오피 in both Seomyeon and Haeundae. You won't be disappointed!

Avatar_small
civaget 说:
2023年12月12日 22:44

My sports-watching experience is top-notch with 스포츠중계.

Avatar_small
civaget 说:
2023年12月14日 18:07

에볼루션카지노 exceeds expectations with its live games. The professional dealers and high-quality streaming make it a top choice for casino enthusiasts.

Avatar_small
civaget 说:
2023年12月14日 18:16

Oga's 출장마사지 is a hidden gem. The therapists are fantastic, and it's the best way to unwind.

Avatar_small
civaget 说:
2023年12月14日 22:44

Elevate your OP game with "오피가이드." Stay updated, find spas, therapies, and relaxation choices with ease.

Avatar_small
civaget 说:
2023年12月15日 00:14

Thanks for making the trustworthy attempt to explain this. I feel very sturdy approximately it and wish to be informed more. If it’s OK, as you reach extra intensive knowledge, would you thoughts adding extra posts very similar to this one with additional info? It might be extremely helpful and helpful for me and my colleagues. 축구중계

Avatar_small
civaget 说:
2023年12月16日 14:58

Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated! 카지노사이트

Avatar_small
civaget 说:
2023年12月16日 21:32

수원출장마사지's personalized approach is just what I need for a relaxing experience. Booking my session now!

Avatar_small
civaget 说:
2023年12月18日 02:57

The popularity scoring system on 티비위키 is a game-changer.

Avatar_small
civaget 说:
2023年12月18日 21:26

The real-time scores and match updates offered by 무료실시간TV중계 enhance the sports-watching experience, keeping fans informed every step of the way.

Avatar_small
civaget 说:
2023年12月20日 03:13

I had an exceptional time at 김포휴게텔. The hot stone massage melted my stress away, leaving me completely relaxed.

Avatar_small
civaget 说:
2023年12月21日 15:06

누누티비's content diversity keeps me entertained around the clock.

Avatar_small
civaget 说:
2024年1月09日 20:04

출장마사지 is a must-try if you want to pamper yourself at home.

Avatar_small
civaget 说:
2024年1月15日 22:28

Strong blog. I acquired several great info. I?ve been keeping an eye fixed on this technology for a few time. It?utes attention-grabbing the means it retains completely different, yet many of the first components remain constant. have you observed a lot amendment since Search engines created their own latest purchase within the field? ufaคืนยอดเสีย

Avatar_small
SEO 说:
2024年2月01日 13:08

Hmm it looks like your website ate my first comment (it was extremely long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but I’m still new to the whole thing. Do you have any tips and hints for rookie blog writers? I’d really appreciate it. lpb piso wifi 10.0.0.1 pause time login

Avatar_small
biggest loser smart 说:
2024年2月05日 15:14

I want looking at and I believe this website got some really useful stuff on it! .

Avatar_small
SEO 说:
2024年2月05日 18:09

Oh my goodness! an excellent article dude. Many thanks However I am experiencing trouble with ur rss . Do not know why Not able to enroll in it. Will there be any person obtaining identical rss dilemma? Anyone who knows kindly respond. Thnkx wood & company


登录 *


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

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com