hi ,i want to know that if i m taking the input from user in C through scanf what should be the code if the requirments are following.
1.should accept string minimum of 3 and maximum of 15 characters.
2.accept alphabets ,blank space hyphen(-)and &
3. first latter should be uppercase.
and another string should
1. accept blank spaces with dot(.)and apostrophe .
mohan_198505 0 Newbie Poster
Recommended Answers
Jump to PostEven if you could use scanf for your purposes, it is better to use fgets anyway.
Jump to Post
scanf("%[^\n]",str);
Do you want to bet I can overflow the 15 characters that str[] can hold?Wat u said regarding the overflow of string array is perfectly right...but my question is can such overflow of array's at such subtle level cause major damages.? if yes how.? and what to refer …
All 7 Replies
Murtan 317 Practically a Master Poster
death_oclock 103 Posting Whiz
csurfer 422 Posting Pro
Aia 1,977 Nearly a Posting Maven
csurfer 422 Posting Pro
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Aia 1,977 Nearly a Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.