私は「n」桁の数字を持っています。同じものの最初の n - 1 桁を出力する必要があります。私の知る限り、これは基本的に 10 による除算です。ただし、これは算術演算子を使用せずに行う必要があります。ctypeでいくつかの変換を使用してみましたが、数値の正確な長さ、つまり no. 桁数がわからないため、同じものを使用できません。
すなわち
convert int to string, say 12345 to string
set the last position of it to '\0', in my case last position is not known
//i.e. 1, 2, 3, 4, '\0', assuming string size is 5
convert it back to int.// 1234
これに利用できる微調整、またはまったく異なるものはありますか?