Posts

Showing posts from June, 2018

Notes on pointer in C

A pointer is a memory address. Assume size of int and char in the compiler as 4 and 1 Byte respectively. & : address of * : Content of (de-referencing operator) int x; //x occupies 4 byte memory int *p; //p is a pointer and address of an integer. It means *p (content of p) will be an integer. p= &x; //now, p is address of x. p is pointer to integer x. p++; //move pointer to next element. As p is the pointer to integer, it's value will increase by 4. int **q; // q is pointer to pointer. (address of address) q=&p; //q is now pointer to pointer to (address of) p. Size of a pointer is fixed for a compiler irrespective of pointer type.  p=(char*)p; //now p is address of char, content of p (*p) will be of size 1 Byte. I recommend to go through this test for checking yourself : https://www.geeksforgeeks.org/c-language-2-gq/pointers-gq/

Simple Interest calculator using HTML and JavaScript

Code: <html>     <head>         <title>Simple interest</title>         <script>             function displynum()             {                 simi.txt4.value=eval("("+simi.txt1.value+"*"+simi.txt2.value+"*"+simi.txt3.value+")"+"/"+"100");             }         </script>     </head>         <body>         Simple Interest Calculator<br><br>         <form name=simi>             Principal amount<br>            ...

Simple Calculator using HTML and JavaScript

Code: <html>     <head>         <title>Calculator</title>                 <script type="text/javascript">                         function displynum(n1)             {                 calcform.txt1.value=calcform.txt1.value+n1;             }                         </script>     </head>         <body>         <form name=calcform>             <input type=text name=txt1...