hello, i have something i want to ask
-
whenever i had to use a string, i used char arr[50] or char arr[size] like that, but now i am seeing many people use the string keyword for making strings.
like string test and it has many functions to make it much more easy to use.
ques: should i start using string keyword for using strings or should i stick to char arr[50] type?? -
i wanted to clear a string. i see that we can use str.clear() function for clearing a string.
but if i have to clear a string which i made by char arr[100]; i.e delete all the contents of the string and make its length to be 0, how should i do it? -
i use fgets() function for inputting a string. ( which i created by char test[50])
lets say i used fgets() for inputting a string called “test” , the user inputted “hellofriend”
and then again i use the fgets() on the same string “test” (without it being cleared) and now the user enters “spell”
what would the string contain then??