Professional Documents
Culture Documents
Unit 3
Unit 3
strcat() Function
strcat() joins two or more strings together. It takes the following form
strcat(string1, string2);
string1 and string2 are character arrays. When the above function is executed, string2
is appended to string1. It does so by removing the null character at the end of string1
and placing string2 from there. The string at string2 remains unchanged. For example,
consider following three strings :
This construct is known as the else if ladder. The conditions are evaluated from the top (of
the
ladder), downwards. As soon as a true condition is found, the statement associated with is
executed and the control is transferred to the statement x (skipping the rest of the ladder).
When all the n conditions become false, then the final else containing the default statement
will be executed.
/*program to check whether the given number is positive, negative or zero: using else if
ladder statement*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
clrscr();
printf("enter a number:");
scanf("%d", &num);
if(num>0)
{
printf("entered value is positive\n") ;
}
else if(num<0)
{
printf("entered value is negative\n") ;
}
else if(num==0)
{
printf("entered value is zero") ;
}
getch();
}
Continue Break
This construct is known as the else if ladder. The conditions are evaluated from the top (of
the
ladder), downwards. As soon as a true condition is found, the statement associated with is
executed and the control is transferred to the statement x
(skipping the rest of the ladder). When all the n conditions become false, then the final else
containing the default statement will be executed.