Skip to content · ⁨الانتقال إلى المحتوى⁩

Parse an integer · ⁨تحليل عدد صحيح⁩

English

Parse an integer

Turn a string like "-123" into the number -123, by hand — the job atoi does. Read an optional leading - to fix the sign, then build the value digit by digit: each new digit means result = result * 10 + digit. A character converts to its digit value with c - '0'.

العربية

تحليل عدد صحيح

حوّل سلسلة نصية مثل "-123" إلى الرقم -123، يدويًا — وهي المهمة التي تقوم بها atoi. اقرأ إشارة leading اختيارية - لتحديد الإشارة، ثم بِن القيمة رقماً برقم: كل رقم جديد يعني result = result * 10 + digit. يُحوّل الحرف إلى قيمته الرقمية باستخدام c - '0'.

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP