海外旅行から帰ってきたら、まず何を食べる?

文字列を入力させ、入力した文字列の長さを出力させるプログラムを作成せよ。
if switch for while do-while 配列 をなるべく使う。
<実行結果>
文字列を入力してください
society
Length of "society" is 7

A 回答 (2件)

> 入力した文字列の長さを



文字列の長さとは?
    • good
    • 0

ご参考に。



#include <stdio.h>
#include <string.h>
#define BUF_SIZE 1024

int main(void)
{
char str[1024];

printf("input a str.\n");
scanf("%s", str);
printf("Length of \"%s\" is %d\n", str, strlen(str));
return 0;
}
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!