把字符串转化为字符数组

来源:互联网 发布:淘宝网店怎么找回 编辑:程序博客网 时间:2024/04/29 22:39

苦逼脆弱的真实:看懂一个人,一定是你在意过; 看清一个人,一定是你落魄过; 看破一个人,一定是你较量过; 看透一个人,一定是你付出过; 看穿一个人,一定是你受骗过; 看淡一个人,一定是你珍惜过; 看明一个人,一定是你放弃过。

 相离莫相忘,且行且珍惜~

#include<assert.h>
#include<stdlib.h>
#include <stdio.h>
#include <string.h>
void main()
{
char string[]={"202.194.231.204"};
char aa[16];
char * p=string;
unsigned int i;
for(i=0;i<=15;i++)
{
aa[i]=*p;
p++;
}

printf("%d\n",aa[0]);
printf("%d\n",aa[1]);
printf("%d\n",aa[2]);
printf("%d\n",aa[3]);

}

想实现把一个字符串转化为一个字符数组,程序有问题,跑出来的结果不对。

 

 

原创粉丝点击