c语言中分隔符都有什么作用啊?

如题所述

c语言中,分隔符有逗号、空白符、分号和冒号。

(1)逗号作为分隔符用来分隔多个变量和函数参数;

(2)空白符常用来作为多个单词间的分隔符,也可以作为输数据时自然输入项的缺省分隔符;

(3)分号常用于for循环语中for后面,圆括号内的三个表达式之间;

(4)冒号用于语句标号与语句之间。

扩展资料

C语言分隔符的使用

#include<stdio.h>

#include<string.h>

intmain()

{

charstr[]="now,isthetimeforall,goodmentocometothe,aidoftheircountry";

chardelims[]=",";

char*result=NULL;

result=strtok(str,delims);

while(result!=NULL){

printf("resultis\"%s\"\n",result);

result=strtok(NULL,delims);

}

}

参考资料来源:百度百科—分隔符

温馨提示:答案为网友推荐,仅供参考
相似回答