char first[10];
char second[10];
What does fscanf(fr,”%s %s\n”,first,second); do when first string is too long?
can I use just char *first without malloc? and the pointer will show to the string?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a width (i.e. “%9s”) to restrict the size of the string. For example, see Microsoft’s documentation.
Using a pointer without initializing it to anything is a sure way to get your program to crash, or otherwise behave badly.