Posts

Showing posts from September, 2020

[POINTERS] IN C

Image
------------------ POINTERS ------------------- WHAT IS POINTER  every variable has a diffrent address in memory. pointer is a special variable who contain the address of the any other variable pointer is defined as ( star * ) symbol . you acces the variable by his address with help of pointers.   .EXAMPLE = ^^^^^^^^^^^^^^^^  RUN SCREEN  $$$$$$$$$$$$$ SOURCE CODE  $$$$$$$$$$$$$ #include <stdio.h> #include <conio.h> main() {     int *j,x=5;     j=&x;     printf( "%d %u" ,x,j);     printf( "\n%d" ,*j);     getch; } ########################## ALL RIGHTS GOES TO [UB CODES] ########################## \---------------------------------------------/

2D [STRING] IN C

Image
------------------ 2D STRING ------------------- WHAT IS 2D STRING  .when we save data by string in 2d array it is called as 2d string  .if we want to save data in group by 2d array we use 2d string ========== RUN screen  MEMORY STRUCTURE  ^^^^^^^^^^^^^^^^^ SOURCE CODE ***************** #include <stdio.h> #include <conio.h> main() { // CODE BY [UB] //     char s[3][10];     int i;     clrscr();     printf( "enter three names= " );         for (i=0;i<=2;i++)     gets(s[i]);     printf( "^^^^^^^^" );        for (i=0;i<=2;i++)       printf( "\n%s" ,s[i]);        getch(); } ######################### ALL RIGHTS GOES TO [UB CODES] ######################### \---------------------------------------------/

[STRING] IN C

Image
--------------- STRING --------------- WHAT IS STRING  NULL CHARACTER  WHAT IS STRING  null character is define as back shash zero \0 . it always type in the end of the string. null character tells you it is the end of the string   PRE DEFINED FUNCTION FOR STRING  . gets = similar like scanf  . puts = similar like printf ^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUN SCREEN  $$$$$$$$$$$$$$ SOURCE CODE  $$$$$$$$$$$$$$  #include <stdio.h> #include <conio.h> main() { // CODE BY [UB] //     char s[30];     clrscr();     printf( "enter your name= " );     gets(s);     puts(s);     getch(); } ######################### ALL RIGTHS GOES TO [UB CODES] ######################### <------------------------------------------------->

[2D] ARRAY

Image
____________ 2D ARRAY ____________ why 2D array  .To store data in group  EX = if you want to store marks of two classes students  then you store 1st class data in first dimension and 2nd class data in 2nd dimension. $$$$$$$ SYNTAX  $$$$$$$ datatype name of array [number of variable][no. of variable] ; EX  = int a[3][3]; ^^^^^^^^^^^^^^^^^^^^ Memory structure  RUN SCREEN  $$$$$$$$$$$$ SOURCE CODE $$$$$$$$$$$$ #include <stdio.h> #include <conio.h> // CODE BY [UB] // main() {     int a[3][3],b[3][3],c[3][3],i,j;     printf( "enter first 9 number matrix= " );     for (i=0; i<=2; i++)         for (j=0; j<=2; j++)             scanf( "%d" ,&a[i][j]);     printf( "enter next 9 number matrix= " );     for (i=0; i<=2; i++)   ...

[ARRAY] in C

Image
-------------- ARRAY -------------- What is array? .Array is group of variable  .Array is linear collection of similar elements .Array is also know as subscript variable $$$$$$$$$$$$$$$$$$$$ Array memory structure  ***************    SYNTAX DATATYPE name of variable [number of variable] EX=  int a[10]; Assining value in Array int a[5]={9,8,7,6,5}; **************** RUN SCREEN  ############  SOURCE CODE  ############ #include <stdio.h> #include <conio.h> // CODE BY [UB CODES] // main() { int a[10],i,sum,r; float avg; clrscr(); printf( "enter 10 number= " ); for (i=0;i<=9;i++) scanf( "%d" ,&a[i]); for (i=0;i<=9;i++) sum=sum+a[i]; avg=sum/10.0; printf( "avrage is %f" ,avg); getch(); } ######################### ALL RIGHTS GOES TO [UB CODES] ######################### \-------------------------------------------------------/

[RECURSION] IN C

Image
---------------------- RECURSION ---------------------- & WHAT IS RECURSION? .Function calling itself is called as recursion  .Recursion is similar to loop .each time function call itself with slightly simple as compare as orignal version Working principal    {easy to learn from diagram } *************** Run screen *************** $$$$$$$$$$$  Source Code $$$$$$$$$$$ #include <stdio.h> #include <conio.h> // CODE BY [ UB CODES ] // main() {     int k;     clrscr();     k=fun(3);     printf( "[ %d ]" ,k);     getch(); } fun( int a) {     int s;     if (a==1)         return (a);     s=a+fun(a-1);     return (s); } ######################### ALL RIGHTS GOES TO [UB] CODES ######################### \-------------------------------------------------...