Specifier is a typedef-name and a very sensitive in C programming. Using an incorrect specifier for the data type being read or written will generate a run time error.
Semoclone ( ; ) is one of the best sensitive symbols in programming. Placing a semicolon ( ; ) after the WHILE or FOR loop is not a syntax error. So it will not be reported by the compiler. However, it is considered to be a logical error as it change
Missing the inclusion of appropriate header file in c program will generate an error. Such a program may compile but the linker will given an error message as it will not be able to find the functions used in the program.
Not putting // before the start of single statement comment is a compiler error. Not putting the */ after the termination of block comment is a compiler error.
The test expression done on exact statement. The good habit of using test expression on exact or fulfill statement. So do not use floating point numbers for checking for equality in the test expression.
// AHF C PROGRAM SOLVING //solving here CHARACTER MANIPULATION FUNCTION ( CMP ) programming problemOUTPUT:
#include<stdio.h> #include<string.h> #define pf printf int main() { char str1[100],str2[100],ptr; //input first string data pf("Enter the first string: "); gets(str1); //input substring data pf("\nEnter the second string: "); gets(str2); //find substring ptr=strstr(str1,str2); if(ptr) pf("\nSubstring is found."); else pf("\nSubstring is not found."); return 0; }
Enter the first string: ahf c programming Enter the second string: f c p Substring is found.
Enter the first string: programming Enter the second string: pro# Substring is not found.