【发布时间】:2021-08-01 13:30:07
【问题描述】:
我一直在尝试将字符串数组中的字符串的第一个字母大写我尝试了很多方法,但我的代码在这里都不起作用:
#include <stdio.h>
#include <stdlib.h>
int nw=0;
char words[30][50];
int main(){
printf("enter your words when you finish write b\n");
do{
nw++;
scanf("%s",&words[nw]);
}while(strcmp(&words[nw],"b")!=0);
printf("%s",toupper(&words[1][0]));
}
我该怎么办,请帮忙
【问题讨论】:
-
你应该正确缩进你的代码。
-
数组从索引 0 开始。
标签: arrays c char c-strings toupper