Note for above post:
Before finding the position of substring we need check strstr() return value. If strstr() returns not NULL only we can find the position of the substring.
Type: Posts; User: abinila
Note for above post:
Before finding the position of substring we need check strstr() return value. If strstr() returns not NULL only we can find the position of the substring.
The following way will give you the correct result.
#include <stdio.h>
#include <string.h>
main()
{
char *s1="school";
char *s2="ool";
Try the following ways,
scanf("%[0-9]s",&s); // Read only digits.
scanf("%[^0-9\n]s", s); // Read other than digits up to newline.
or
Try the following algorithm for your additional requirement.
- Check the firstname whether it is a null.
- Compare the current lastname with next record lastname .
- The above 2 conditions...
Once we got the question from any site , we need to analyze the question and answer. I think blindly no one accept the answer from any site.
I corrected your code. You made some mistakes as Adak said. Another one thing, You are avoiding the 0th index in an array. Is there any specific reason for this?. This is not a problem in your code....
Using stat function we can get the file type. As well as in unix we can use the stat command also.But stat command lot of situations give regular file as the type. Better we can use stat function....
Try this link.
100 Multiple choice questions in C
I don't know which technique you are using for menu selection. I will give you the two way to select the menu.In these ways there is no problem as you mentioned.
Try this,
main ( int argc,...
You created the structure variable as a pointer. As a pointer it must point to a valid memory location
You didn't assign any address to that pointer variable. So that you got an error.
Try this,...
Try this code,
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>