Posts

New Animated Login or signup page made by HTML, CSS and JavaScript.

  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > Animated Login And Registration Form </ title >     < link rel = "stylesheet" type = "text/css" href = "style.css" >     < link href = 'https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel = 'stylesheet' > </ head > < body >     < div class = "wrapper" >         < div class = "form-wrapper sign-in" >             < form action = "" >                 < h2 > Login </ h2 >                 < div class = "input-group" >                     < input type = "...

Wild Pointer in C

  #include <stdio.h> #include <conio.h> #include <stdlib.h> int main () {     int a = 334 ;     int * ptr ; //This is a wild pointer     // *ptr = 34;//This is not a good thing to do     ptr = & a ; //ptr is no longer a wild pointer     printf ( "The value of a is %d \n " , * ptr );     return 0 ; }

NULL Pointer in C.

  #include <stdio.h> #include <conio.h> int main () {     int b = 34 ;     int * pt = & b ;     printf ( "The address of b is %d \n " , pt );         int a = 34 ;     int * ptr = NULL ;     if ( ptr != NULL )     printf ( "The address of a is %d \n " , * ptr );     else {         printf ( "The pointer is a null pointer and can not be defrenced" );     }     return 0 ; } OUTPUT: The address of b is 6422288 The pointer is a null pointer and can not be defrenced

Void Pointer in C.

  #include <stdio.h> #include <conio.h> int main () {     int a = 345 ;     float b = 6.9 ;     void * ptr ;     ptr = & b ;     printf ( "The value of b is %f \n " , *(( float *) ptr ));     ptr = & a ;     printf ( "The value of a is %d \n " , *(( int *) ptr ));     return 0 ; } OUTPUT: The value of b is 6.900000 The value of a is 345

Storage Classes in C: Static, Extern, Auto and register.

  #include <stdio.h> // int sum = 897; // int sum = 0; int myfunc ( int a , int b ) {     // int sum;     static int myVar ;     myVar ++;     printf ( "The myVar is %d \n " , myVar );     // sum = a + b;     return myVar ; } //  int myVar = 898; int main () {     int myVar = myfunc ( 3 , 5 );     myVar = myfunc ( 3 , 5 );     myVar = myfunc ( 3 , 5 );     myVar = myfunc ( 3 , 5 );     myVar = myfunc ( 3 , 5 );     myVar = myfunc ( 3 , 5 );         return 0 ; } OUTPUT: The myVar is 1 The myVar is 2 The myVar is 3 The myVar is 4 The myVar is 5 The myVar is 6

USE OF MALLOC() AND REALLOC() AND FREE(ptr) in c

  #include <stdio.h> #include <stdlib.h> int main () { //     // use of malloc //     int *ptr, n; //     printf("Enetr the sie of the array you want to create\n"); //     scanf("%d", &n); //     ptr = (int *)malloc(n * sizeof(int)); //     for (int i = 0; i < n; i++) //     { //         printf("Enter the value of no %d of this array\n",i); //         scanf("%d", &ptr[i]); //     } //      for (int i = 0; i < n; i++) //     { //         printf("The value at %d of this array is %d\n",i,ptr[i]);         //    } // use of calloc     int * ptr , n ;     printf ( "Enetr the sie of the array you want to create \n " );     scanf ( " %d " , & n );     ptr = ( int *) calloc ( n , sizeof ( int ));     for ( int i...

USE OF MALLOC() IN C

  #include <stdio.h> #include <stdlib.h> int main () { //     // use of malloc     int * ptr , n ;     printf ( "Enetr the sie of the array you want to create \n " );     scanf ( " %d " , & n );     ptr = ( int *) malloc ( n * sizeof ( int ));     for ( int i = 0 ; i < n ; i ++)     {         printf ( "Enter the value of no %d of this array \n " , i );         scanf ( " %d " , & ptr [ i ]);     }       for ( int i = 0 ; i < n ; i ++)     {         printf ( "The value at %d of this array is %d \n " , i , ptr [ i ]);            }   free ( ptr );             return 0 ; } OUTPUT: Enetr the sie of the array you want to create 5 Enter the value of no 0 of this array 78 Enter the value of no 1 of this array 56 Ente...

STRUCTURE IN C PROGRAMMING.

  #include <stdio.h> #include <string.h> struct student {     int id ;     int marks ;     char fav_char ;     char name [ 34 ]; }; int main () {     struct student aatifa , xyz , abc ;     aatifa . id = 1 ;     xyz . id = 2 ;     abc . id = 3 ;     aatifa . marks = 445 ;     xyz . marks = 450 ;     abc . marks = 451 ;     aatifa . fav_char = 'p' ;     xyz . fav_char = 'p' ;     abc . fav_char = 'p' ;     strcpy ( aatifa . name , "aatifa is a programmer" );     printf ( "aatifa got %d marks \n " , aatifa . marks );       printf ( "aatifa's name is: %s \n " , aatifa . name );     return 0 ; } OUTPUT: aatifa got 445 marks aatifa's name is: aatifa is a programmer

TYPEDEF IN C PROGRAMMING.

  #include <stdio.h> typedef struct student {     int id ;     int marks ;     char fav_char ;     char name [ 34 ]; } std ;     int main ()     {         // struct student s1, s2;         std s1 , s2 ;         s1 . id = 34 ;         s2 . id = 89 ;           printf ( " Value of s1's id is %d \n " , s1 . id );           printf ( "Value of s2.s id is %d \n " , s2 . id );     // typedef <previous_name> <alias_name>;     // typedef unsigned long ul;     // typedef int integer;     // ul l1, l2, l3;     // integer a=4;     // printf("%d", a);     return 0 ;     } OUTPUT: Value of s1's id is 34 Value of s2.s id is 89

UNION IN C PROGRAMMING.

  #include <stdio.h> #include <string.h> union student {     int id ;     int marks ;     char fav_char ;     char name [ 34 ]; }; int main () {     union student s1 ;     s1 . id = 1 ;     s1 . marks = 45 ;     s1 . fav_char = 'u' ;     strcpy ( s1 . name , "Aatifa" );     printf ( "The id is %d \n " , s1 . id );     printf ( "The is marks %d \n " , s1 . marks );     printf ( "The fav_char is %c \n " , s1 . fav_char );     printf ( "The name is %s \n " , s1 . name );     return 0 ; } OUTPUT: The id is 1769234753 The is marks 1769234753 The fav_char is A The name is Aatifa