Posts

[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 ######################### \-------------------------------------------------...

[FUNCTION] takes something return something

Image
------------------- FUNCTION -------------------   [ Takes something Return Something ] . when a function takes some data to done it's work and also return data it is called as   Takes something Return Something ^^^^^^^^^^^^^^^  RUN SCREEN  $$$$$$$$$$$$$$ $ SOURCE CODE $ #############  #include <stdio.h> #include <conio.h> //[ UB CODES ] // int add( int , int ); int main() {     int x,y,s;     clrscr();     printf( "enter two number= " );     scanf( "%d %d" ,&x,&y);     s=add(x,y);     printf( "sum is=[ %d ]" ,s);     getch(); } int add( int a, int b) {     int c;     c=a+b;     return (c); } ######################### ALL RIGHTS GOES TO [ UB CODE ] ######################### <---------------------------------------------------->

[FUNCTION] takes nothing return something

Image
--------------------- FUNCTION --------------------- [ Takes nothing return something  ] . When function don't takes any data and return something it called as  Takes nothing return something    ########### RUN SCREEN ########### ^^^^^^^^^^^^^^^^^^^  $  source code $ #include <stdio.h> #include <conio.h> // takes nothing return something // //code by UB // int add( void ); void main() { int x; clrscr(); x=add(); printf( "sum is %d" ,x); getch(); } int add() { int c,a,b; printf( "enter two number= " ); scanf( "%d %d" ,&a,&b); c=a+b; return (c); } ########################### &ALL RIGHTS GOES TO [UB CODES]$ ########################### <--------------------------------------------------------->

[Function] Takes something return nothing

Image
------------------- FUNCTION ------------------- [ Takes something return nothing ] . when a function takes some data but don't return . it is called as takes something return nothing Run screen  ******************* SOURCE CODE ******************* #include <stdio.h> #include <conio.h> // takes something return nothing // //code by UB // void add( int , int ); void main() { int x,y; clrscr(); printf( "enter two number= " ); scanf( "%d %d" ,&x,&y); add(x,y); //actual argument [ call by value ] // getch(); } void add( int a, int b) // formal argument // { int c; c=a+b; printf( "sum is [%d]" ,c); } ######################### ALL RIGHTS GOES TO [UB CODES] ######################### <--------------------------------------------------->

Functions in C

Image
##########  FUNCTION ######### what is function 1 Function is piece of code to accomplish any certain opration 2 it has a name for identification 3 Function are two types  . pre defined functions [ exapmle= clrscr(); ] . user defined function [ example= made by user like you can see in source code ] TERMS OF FUNCTION. . Function defenation ( funcation defenation are 4 types) 1. takes nothing returns nothing 2. takes something returns nothing 3. takes nothing returns something 4. takes something returns something  . function declaration ( function prototype ) you can read from source code.  . function call  -------------------------------- function run screen -------------------------------- **************** Source Code ***************** #include <stdio.h> #include <conio.h> void add( void );  // function declaration or prototype // void main() {     clrscr();     add(); // function call //   ...

Function [ takes nothing returns nothing ]

Image
_________________________________________ Takes nothing returns nothing [ function ] ------------------------------------------------------------------ . when function cannot takes or returns any type of data that is called   takes nothing returns nothing means { void }   . VOID = this keyword shows their has no data returns or takes  ------------------ run screen ------------------ $$$$$$$$$$$$$$ #include <stdio.h> #include<conio.h> void  add( void );  //  function declaration or prototype  // void  main() {     clrscr();     add(); //  function call  //     getch(); } void  add() //  function defenation  // { int  a,b,c; printf( "enter two number= " ); scanf( "%d %d" ,&a,&b); c=a+b; printf( "sum is [ %d ]" ,c); }       ####################### All rights goes to $[UB codes]$ ####################### <------------------------...

if else in C

Image
#----------------------# IF else code  #---------------------# x>y ? printf(" ") : printf(" ");  PROGRAM RUN  SCREEN  #####################         [  source code ] #include <stdio.h> #include <conio.h> main() { int x; clrscr(); printf( "\nThis program is made by[UB]to check number is positive or not" ); printf( "                                                     " ); printf( "                                              ...

Break in C

Image
* BREAK * B reak is use to end loop body | break;  | ------------------------------ Break run screen  ------------------------------ $ source code $ ################## #include <stdio.h> #include <conio.h> // code by [UB] // main() {     int i=i,x;     while (i<=5)     {         printf( "enter a number= " );         scanf( "%d" ,&x);         if (x<=0)             break ;         i++;     }     i==6 ? printf( "end normaly" ) : printf( "apply break" );     getch(); } ############################### *ALL RIGHTS GOES TO [UB CODES]*  \-----------------------------------------------------/

LOOPS

Image
* LOOPS* {loops are three types } &&&&&&&&&&&&&&& 1st = while  syntax while(variable<=5) { variable++ } &&&&&&&&&&&&&&&& 2nd= do while  syntax do  { variable++ } while(variable<=5); $$$$$$$$$$$$$$$$$$$$$$$ 3rd=for  [ mostly used by me ] syntax for(variable=1;variable<=5;variable++) { } --------------------------------------------- * PROGRAM RUN SCREEN * --------------------------------------------- # SOURCE CODE # ################ #include <stdio.h> #include <conio.h> // code [UB] // main() { int i=1; clrscr(); for (i=1;i<=1000000000000;i++) { printf( "\f😈hello motherfu***r😈" ); } getch(); } ################### *ALL RIGHTS GOES TO [UB CODES]* /-------------------------------------------------\

Switch in C

Image
SWITCH IN .C switch keyword is use to choose any one option   [syntax] switch(variable ) { } ----------------------------------------- swtch program run screen ------------------------------------------ s ource code  ################# #include <stdio.h> #include <conio.h> // code by [UB] // main() {     int choice,a,b,s;     clrscr();     while (1)     {         printf( "\n###################" );         printf( "\n1. add numbers" );         printf( "\n2. odd or even" );         printf( "\n3.  multiply  " );         printf( "\n4. devide     " );         printf( "\n5. About devloper" );         printf( "\n...