ft_strlen


1.プロトタイプ

size_t	ft_strlen(const	char *str)
  • ヘッダ
  • #include <string.h>
  • size_t	strlen(const char *s)
  • size_t
    #inlcude 必須.
    サイズを表す変数として使用します.
    最大サイズの符号なしデータ型を理論的に含めることができる.
    すなわち、32ビットマシンでは32ビットの符号なし整数型(符号なし整数ではなく「整数」)が、64ビットマシンでは64ビットの符号なし整数型(符号なしlong long)が
  • である.

    2.用途


    パラメータは文字列の長さの関数を渡します.

    3.戻り値


    パラメータとして渡される文字列の長さを返します.

    4.コード実装

    #include "libft.h"
    
    size_t	ft_strlen(const	char *str)
    {
    	size_t	t;
    
    	t = 0;
    	while (str[t] != '\0')
    		t++;
    	return (t);
    }

    5.コード説明

  • libft.h上#inlcudeを含み、size tを使用できます.