السلام عليكم
المثال التالي ارسلت عبارة this is a test كثابت الى الدالة لي مجنني كيف تم التعديل على النص مع انه ثابت const
وهذا هو المثال
#include
void sp_to_dash(const char *str);
main()
{
sp_to_dash("this is a test");
return 0;
}
void sp_to_dash(const char *str)
{
while(*str)
{
if (*str==' ')
printf("%c",'-');
else
printf("%c",*str);
str++;
}
}وماذا يقصد بان عبارة const تحمي ال object pointed