Skip to main content

WHAT IS CSS?ADVANTAGES, SYNTAX.

 CSS PROGRAMMING LANGAUGE                                                                     disadvantages CSS full form is cascade style sheets , which we call it says about how you should display the HTML elements on the screen. CSS tells us the style of the webpage let us take a simple example, if we build a home first we lay out the design that is known as the HTML language. Where the CSS means layout which means giving instructions on how the furniture should be nothing but the CSS. For example if we take PayPal we can see that the background color blue says the CSS background-color property. Netflix is also the best way of saying  CSS property, but if we remove it will be a normal webpage but with the red color and the black plus symbols it looks like the best webpage. Versions of CSS There are different versions available now in case it is developed by Wium we have three versions that are css1, css2, and css3. Currently we are using this css3 version this is the best version fo

STRINGS IN C?MANIPULATION FUNCTIONS

 WHAT IS STRING:

                                                               
strings
FUNCTIONS

  • Sequence of characters represented as a single entity is nothing but a string, A character array terminated by a null character(\0) is known as a string.
  • For eg:- char name[5]="good"; we can write a string first define the data type that is char, and declare the variable that names, with size 5 equal to double codes good.
  • There many ways to create a string, the first one is to define the size [5], the second method is without size, third is to give with predefined size. 

C PROGRAM CREATE STRING, DISPLAY IT.

 #include<stdio.h>
 main()
{
 char name[]={"p", "o", "s", "i", "t", "i", "v", "e"};
 int i=0;
 while(name[i]='\0')
 {
  printf("%c",name[i]);
  i++;
 }
}
  • Firstly declare the stdio. h, then the main function declares the char data type, and name variable within the curly brackets write the words and by using the while loop check it if executes do incrementation.

PROGRAM PROMPT USER NAME, DISPLAY IT

#include<stdio.h>
main()\
{
 char name[42];
 printf("enter your name:");
 scanf("%s",name);
 printf("your name is %s",name);
}

  • Gets() function is used to store the given string in place of scanf, we use it in strings.
  • If we use user input containing a space in the text, this program takes the next up to the space only in order to remove we use this function.

Program  gets() function 

#include<stdio.h>
main()
{
 char name[42];
 printf("enter your name:");
 gets(name);
 printf("name is %s",name);
}
  • puts() library function is used to display the text we use printf in c programs but in strings.
  • The main thing in this is the gets function which stores the name value and prints it on the monitor.

PUTS() FUNCTION

#include<stdio.h>
main()
{
 char name[6];
 strcpy(name,"hi");
 puts(name);
}
  • Puts functions place the name value and consoles it on the monitor.

String manipulation functions

  • In the header file "string.h", following library functions are provided to deal with strings.
  • There are strcat() this library function appends or adds at the end one string to the other.
          Syntax:- strcat(s1,s2);

      #include<stdio.h>
      void main()
     {
       char s1[]="Hello";
       char s2[]="hi";
       strcat(s1,s2);
       printf("%s",s1);
     }
   
    Output:- "Hello hi"
  • strcpy() library function almost acts as a string assignment operator, It assigns a string literal to a string-type variable, Copies the content of the string to the other.
         #include<stdio.h>
         #include<string.h>
          main()
        {
          char s1[10]="";
          char s2[10]="hello";
          strcpy(s1,s2);
          printf("%s",s1);
        }
  •  This function copies the value double codes and then hello prints it.     
        Output on the console: "Hello"
  • strlen(): This is used to find the length of the string i.e. to find the number of characters in the string.
         #include<stdio.h>
         #include<string.h>
         main()
        {
          char college[]="iii";
          int n=strlen(college);
          printf("length of the string is %d",n);
         }
  • It finds the length of the string we can either give the length or define it while writing the code.
  • strcmp():  Compare two strings for equality if they are equal, this function returns 0.
         #include<stdio.h>
         #include<string.h>
         main()
        {
          char s1[]="hello";
          char s2[]="hi";
          int n=strcmp(s1,s2);
          if(n==0)
            printf("the given strings are equal");
          else  
            printf("not equal');
         }
  • strncpy():  Copies specified number of content from one string to the other.
#include<stdio.h>
#include<string.h>
void main()
{
char str1[30]="hi";
char str2[40]="hello";
strncpy(str1);
strncpy(str2);
printf("%d\n");
}
  • strncat(): Adds the specified content from string to other.
#include<stdio.h>
#include<string.h>
void main()
{
char str1[10]="world";
char str2[20]="hello";
strncat(str2,str1);
}
  • strncmp(): Compares the required number of characters from strings. 
#include<stdio.h>
#include<string.h>
void main()
{
char s1[30];
char s2[10];
if(s1=s2)
{
printf("successfully");
}
else
{
printf("not");
}
  • strstr(): Search for a string in another string.\
#include<stdio.h>
#include<string.h>
void main()
{
 char ch[50]="whats";
 char s4[40]="up";
 if(ch==s4)
{
printf("executed");
}
else
{
printf("not");
}
  • In the previous blogs we learned about different operators and their types of arithmetic, and assignments.



 


                       

Comments

Popular posts from this blog

WHAT IS C LANGUAGE? USES, COMPILER

C LANGUAGE C language compiler, C is one of the most popular languages in programming,  Dennis M.RITCHIE invented C programming in the year the 1970s,  C is a high-level programming language which means, its instructions are away from the understanding of the processor. There is a small difference between C language and C++ that is c does not provide object-oriented support. C++ gives class-based support(ORS) which means the same as the previous line in this blog. WHY LEARN C  LANGAUGE Learning C language and a compiler will be useful for coding. Especially for making a website with C language. If we learn C++ it will be useful for making a website. This means C language is only used for making a website but C++ is used for adding colors background colors etc. C language is one of the straightforward languages means easily understandable language. USES OF C LANGUAGE While the C language is used, in the creation of hardware devices.  It is also used in the OS, that is the operating sy

OPERATORS IN C?ARITHMETIC, ASSIGNMENT....

  O PERATORS IN C                                                                  operators A n op erator is a symbol that acts on data items known as operands in order to process them.   for eg-   a+b   ( "a" and "b" are operands, and "+" is an operator ).               c-a     ( " c "&"a"  both are operands "-" operator ).    We can do addition, subtraction, multiplication, division, etc........ Operand and the operator plays a very important role in the programming language. CLASSIFICATION OF OPERATORS B ased number of operands operating upon, operators are classified into three types. Unary operators(operate upon single operand). Binary operators(operate upon two operands). Ternary operators(three operands). On the type of execution they perform on the operands, operators are classed  into six types Arithmetic operator :-arithmetic operators are the operators which perform addition( + ), subtraction( - ), multipli

FUNCTIONS IN C?CLASSIFICATION, PARAMETERS, LOCAL VARIABLE.

 WHAT IS A FUNCTION                                                                         function A self-contained, named block of code that performs the specific task when called is nothing but a function. Note:-functions are the task performers in C projects.  FUNCTIONS CLASSIFICATION We have 2 types of functions they are user-defined functions and library functions. A pre-created function that comes with C installation is nothing but a library function, For eg:- print () and scanf(). Library functions are ready-made named code blocks. We need not create them, Just use them in our programs. We can make use of this library function by making the library function available to the program and the next step is calling the library function. Our own created function which is the program-created function is nothing but a user-defined function , eg- the main function is the example of a user-defined function. BENEFITS OF USER-DEFINED FUNCTION There are many benefits of user-defined func