Array of Pointer and Pointer to Pointer in C Programming

Bhanu Priya
Updated on 09-Mar-2021 08:20:19

2K+ Views

Array Of PointersJust like any other data type, we can also declare a pointer array.Declarationdatatype *pointername [size];For example, int *p[5]; //It represents an array of pointers that can hold 5 integer element addressesInitializationThe ‘&’ is used for initializationFor example,int a[3] = {10,20,30}; int *p[3], i; for (i=0; i

Explain Arithmetic Operations Using Pointers in C Language

Bhanu Priya
Updated on 09-Mar-2021 08:15:19

2K+ Views

Pointer is a variable which stores the address of other variable.Pointer declaration, initialization and accessingConsider the following statement −int qty = 179;Declaring a pointerint *p;‘p’ is a pointer variable that holds the address of another integer variable.Initialization of a pointerAddress operator (&) is used to initialize a pointer variable.int qty = 175; int *p; p= &qty;Arithmetic operations using pointersPointer variables can be used in expressions. For example, if pointer variables are properly declared and initialized then the following statements are valid.a) *p1 + *p2 b) *p1- *p2 c) *p1 * *p2 d) *p1/ *p2 Note: There must be a blank ... Read More

Pass Individual Elements in an Array as Argument to Function in C

Bhanu Priya
Updated on 09-Mar-2021 08:10:07

2K+ Views

If individual elements are to be passed as arguments, then array elements along with their subscripts must be given in function call.To receive the elements, simple variables are used in function definition.Example 1#include main (){    void display (int, int);    int a[5], i;    clrscr();    printf (“enter 5 elements”);    for (i=0; i

Pass Entire Array as an Argument to a Function in C

Bhanu Priya
Updated on 09-Mar-2021 08:08:41

1K+ Views

ArrayThe array is a group of related items that store with a common name. Following are the two ways of passing arrays as arguments to functions −sending entire array as argument to functionsending individual elements as argument to functionSending entire array as an argument to a functionTo send entire array as argument, just send the array name in the function call.To receive an array, it must be declared in the function header.Example 1#include main (){    void display (int a[5]);    int a[5], i;    clrscr();    printf ("enter 5 elements");    for (i=0; i

Print Numbers in Different Formats Using C Program

Bhanu Priya
Updated on 09-Mar-2021 08:07:30

680 Views

ProblemWhat is the logic in C language to print the numbers in different formats like pyramid, right angle triangle?SolutionTo print the numbers or symbols in different model we can take the help of for loop in the code.Example1Following is the C program to print pyramid − Live Demo#include int main(){    int n;    printf("Enter number of lines: ");    scanf("%d", &n);    printf("");    // loop for line number of lines    for(int i = 1; i

Scope Rules for Functions in C Programming

Bhanu Priya
Updated on 09-Mar-2021 08:03:16

570 Views

Local scopeLocal scope specifies that variables defined within the block are visible only in that block and invisible outside the block.Global scopeGlobal scope specifies that variables defined outside the block are visible up to end of the program.Example#include int r= 50; /* global area */ main (){    int p = 30;    printf (“p=%d, r=%d” p, r);    fun (); } fun (){    printf (“r=%d”, r); }Outputp =30, r = 50 r = 50Scope rules related to functionsA Function is a block of statements that performs a particular task.Variables that are declared within the body of a function ... Read More

Local and Global Scope Rules in C Language

Bhanu Priya
Updated on 09-Mar-2021 07:27:45

365 Views

Global scopeGlobal scope specifies that variables defined outside the block are visible up to end of the program.Example#include int c= 30; /* global area */ main (){    int a = 10;    printf (“a=%d, c=%d” a, c);    fun (); } fun (){    printf (“c=%d”, c); }Outputa =10, c = 30 c = 30Local scopeLocal scope specifies that variables defined within the block are visible only in that block and invisible outside the block.Variables declared in a block or function (local) are accessible within that block and does not exist outside it.Example#include main (){    int i = ... Read More

Major Contributors to MySQL

AmitDiwan
Updated on 09-Mar-2021 07:26:40

245 Views

Let us see who the major contributors to MySQL are −Although Oracle Corporation and/or its affiliates own all copyrights in the MySQL server and the MySQL manual, we wish to recognize those who have made contributions of one kind or another to the MySQL distribution. Contributors are listed here, in somewhat random order −Gianmassimo Vigazzola − They helped with the initial port to Win32/NT.Per Eric Olsson − They provided for constructive criticism and real testing of the dynamic record format.Irena Pancirov − Helped with the Win32 port with Borland compiler. They also helped with the mysqlshutdown.exe and mysqlwatch.exe.David J. Hughes ... Read More

Upgrading MySQL Binary or Package-Based Installations on Unix/Linux

AmitDiwan
Updated on 09-Mar-2021 07:24:51

325 Views

Let us understand how MySQL binary and package-based installations can be upgraded in Unix or Linux. This can be done in-place as well as by using a logical upgrade method. Let us understand both these methods in brief −In place upgradeAn in−place upgrade involves shutting down the old MySQL server, replacing the old MySQL binaries or the packages with the new ones.Once this is done, the MySQL server is restarted on the existing data directory.After this, the remaining parts of the existing installation, that require some kind of upgrade, are upgraded.For some Linux platforms, MySQL installation from RPM or Debian ... Read More

Check MySQL Version

AmitDiwan
Updated on 09-Mar-2021 07:23:43

810 Views

Let us understand how to check the version of MySQL that the user is currently running −Before entering queries on the console, it is important to ensure that the user is connected to the server.Check MySQL VersionThe below query would give the version number of the server being used, and the current date.mysql> SELECT VERSION(), CURRENT_DATE;Note: The function ‘VERSION()’ and ‘CURRENT_DATE’ are case −insensitive. This means ‘version()’, ‘Version()’, ‘vERsion()’, all mean the same. Same goes with ‘CURRENT_DATE’QueriesLearn about MySQL QueriesAn SQL query is followed by a semi−colon.When a query is issued to mysql, it sends the query to the server ... Read More

Advertisements