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 differen...

FUNCTIONS IN C?CLASSIFICATION, PARAMETERS, LOCAL VARIABLE.

 WHAT IS A FUNCTION


                                                                       
functions in arguments
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 functions, the first one is code reusability which means we can use the code a number of times as when we want in the program writing.
  • The second one is modularity is another thing of a user-defined function. Make use of this user-defined function by declaring the function that is the prototype, calling function.

SYNTAX TO DEFINE FUNCTION

  • <return type>   <identifier>(parameters)
     {
       <task performing code>
     }
  •  
    For eg.
    void add()//function header
{ int a=10; int b=20; int sum=a+b; printf("The sum is %d",sum); }
  •  The elements of a function definition function header,body code enclosed between two flower braces are nothing but a function body.
    		   
  • The function body has 2 parts task performing return statement(optional).

OUTPUT PROGRAMS

  • //addition1.c #include<stdio.h> void add(); main() { } void add() { int n1,n2,sum; printf("Enter the first number:"); scanf("%d",&n1); printf("Enter the second number:"); scanf("%d",&n2); sum=n1+n2; printf("The sum of %d and %d is %d",n1,n2,sum); }
  • //addition2.c
    #include<stdio.h>
    void add();//prototype of the function
    main()
    {  
        add();//calling the function
    }
    void add()  //defining the function
    {
        int n1,n2,sum;
        n1=20;
        n2=30;
        sum=n1+n2;
        printf("The sum is %d",sum);
     }
  • //addition2.c
    #include<stdio.h>
    void add()  //defining the function
    {
        int n1,n2,sum;
        n1=20;
        n2=30;
        sum=n1+n2;
        printf("The sum is %d",sum);
     }
    main()
    {  
        add();//calling the function
    }
PARAMETERS OF FUNCTION
  • Variables declared in the function header while defining a method are known as parameters.
For eg.
            void add(int a,int b)
           {
	     .....
            }
  • In the above example, a are parameters, to give input data to the function. I.e. parameters are the means by which data are input to the function for processing.
  • What is a non-parameterized function: A function that doesn't have parameters is nothing but a non-parameterized function.

ARGUMENTS

  • Data items(values) supplied to a function during the function call are nothing but arguments.
  • In the following add function call, 10 and 20 are arguments.
                       add(10,20);
  • //addition5.c
    #include<stdio.h>
    int  add(int a,int b);//function prototype
    main()
    {
       int sum=add(10,20);//function call
       printf("The sum is %d",sum);
    }
    int add(int a,int b)
    {
       int sum=a+b;//data processing
       return sum;  //processed data returning to the caller 
    }

LOCAL VARIABLE

  • A variable declared inside a function is called a local variable, of one function that is not available to another function.
  • Variables declared outside the functions (in the global declaration section) are called global variables. Global variables are available to all the functions of the program.
  • #include<stdio.h>
    void add(int ,int );
    int subract(int ,int );
    int result;//global variable
    main()
    {
       result=subtract(10,6);
    }
    void add(int a,int b) // a & b are local variables
    {
       result=a+b;
    }
    int subtract(int n1,int n2) //n1&n2 are local variables
    {
         result=n1-n2;
         return result;
    }
  • So in this blog, we talked about functions in c topic and the classification of it then what is parameter, argument, local variable, some of the output programs too.
  • In the coming blogs we are going to start html blogs in that we are going to cover all the topics.

Comments

Popular posts from this blog

BASIC PROGRAM IN C LANGUAGE? INCLUDE, HEADER.

SIMPLE PROGRAM TO PRINT NAMES ON                     CONSOLE USING C LANGUAGE #include <stdio.h> which means that <stdio.h> is the header file that says, that standard input and output header file, so every time there is a format writing the c language program that is the starting line of the code. And Include is the command that we use in the program to include the header file <stdio.h> and this file contains the Printf function means to, display any text onto the console. To use the print function, we need to use #include<stdio.h> then only the print function can be accessed otherwise not.   The first line of the code of the program is, #include<stdio.h> this is the most compulsory step we can say in a c program.                                                    ...

ARRAYS IN C?SCALAR VARIABLE,DISADVANTAGES

SCALAR VARIABLE:-                                                       A  scalar variable is that which can hold only one value it is known as a scalar variable. For eg:- int a=10;                          a=30; DISADVANTAGES OF SCALAR VARIABLE :-      Whenever multiple data items are required to be in the computer memory and access those data items scalar variables have 2 limitations: increase code and performance problems. AGGREGATE VARIABLE:- A variable that can hold multiple values(data items) is known as an aggregate variable. WHAT IS AN ARRAY :- An array is an index-based collection of homogenous elements, the array is a collection of  (continuous) memory locations referred to by a common name that can hold multiple values. Is a subscripted variable that can...

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 ...