Problem Statement - 1:

1)Write a C-Program to input a 3x4 matrix and print in the form of a matrix

Source Code:















Input & Output:


Problem Statement - 2:
Write a program to print the following pattern
                        1
                1    2    1
1        2        3    2    1

Source Code:




Input & Output:

Problem Statement - 3:
Write a program to calculate the factorial of a function using recursive concept with the help of parameter passing and return value.

Source Code:

Input & Output:


Similarly, you can also learn the structures, arrays, unions and pointers concepts in C programming Language.

If you have any doubts or you want us to create some more concepts or if you can't solve any problems please give them in the form of your comments.


If you like the content we had given and understood it well then give your valuable rating for this page and comment on your experience in the comment box .



  Sundar Pichai  CEO @Google and Alphabet

Biography: 

  • Pichai Sundararajan, also known as Sundar Pichai, Pichai was born in Madras (now Chennai), Tamil Nadu, India. 
  • His mother, Lakshmi, was a stenographer, and his father, Regunatha Pichai, was an electrical engineer at GEC, the British conglomerate. His father also had a manufacturing plant that produced electrical components. 
  • Pichai grew up in a two-room apartment in Ashok Nagar, Chennai, and had a Hindu upbringing.


Education: 

  • Pichai completed schooling in Jawahar Vidyalaya Senior Secondary School, a Central Board of Secondary Education school in Ashok Nagar, Chennai. 
  • He completed the Class XII from Vana Vani school at IIT Madras. 
  • Later he cracked the IIT-JEE examinations and joined IIT Kharagpur where he pursued a course in Metallurgy(1993).
  •  After his B-Tech, he like many others of his generation went off to the United States where he completed a Master's in Science from Stanford(1995).
  • Then earned an M.B.A. (2002) from the Wharton School of the University of Pennsylvania.


Professional Career: 

  • After completing his MBA, Pichai initially joined Applied Materials(a supplier of semiconductor materials) as a Product Manager 
  • Then worked as a management consultant with McKinsey. 
  • Pichai joined Google in 2004, where he led the product management and innovation efforts for a suite of Google's client software products, including Google Chrome and Chrome OS, as well as being largely responsible for Google Drive. 
  • Later he worked in google as vice-president of product management and worked on the Toolbar which was designed to simplify search on Microsoft's Internet Explorer and Mozilla's Firefox Toolbar’s success inspired Pichai to launch Google's own browser. 
  • In 2008, Google launched Chrome which became a hit with millions across the world in no time 
  • His stellar performance soon saw Pichai being promoted as the senior vice-president of Google Chrome and Google Apps in 2012 
  • In 2013, Google promoted him as the head of the company's mobile operating system, Android, 
  • By 2014 he was given charge of Search, Maps, and Gmail. With this, the IIT-Kharagpur alumnus became one of the most powerful technology executives in the world. 
  • In 2014, he was one of the candidates in contention for the post of Microsoft CEO, but Google managed to retain him. 
  • In a blog post in August 2015, Larry Page announced the launch of Alphabet and Google became a subsidiary of this new company and Pichai was made the CEO of Google. 
  • In 11 years he rose the ladder and became the operations chief of the technology behemoth which now consisted of Search, Advertising, Maps, YouTube, and Android. 
  • Since he took over, Google's market cap more than doubled to $900 billion. 
  • Pichai’s special interest in India has led Google to tie up with the Indian Railways for high-speed internet at railway stations. 
  • In December 2019, Google’s founders Larry Page and Sergey Brin wrote a letter in which they announced that they were stepping down and appointed Sundar Pichai as the CEO of Alphabet in addition to his existing role of Google CEO.

Similarly you can also learn the structures, arrays, unions and pointers concept in C programming Language.

                                   ARRAYS (C Programming)

Definition:

  1. An array is a collection of similar data type items stored at contiguous(Continuous) memory locations.
  2. The array is the simplest data structure where each data element can be accessed by using its index number.
  3. if you want to store the marks of a student in 6 subjects, then traditionally we need to define different variables for the marks in the different subjects. But Instead of that, we can define an array that can store the marks in each subject at the contiguous memory locations.


Declaration:

  1. In C programming Array can be created as 
  2. data_type array_name[array_size]
  3. Here data_type is to declare whether we want to store integers or characters or floating-point numbers etc.
  4. Array_name is some user-defined name given to your array to be created.
  5. Array_size is the size of the array to be created, as the array must be created with a predefined size


Example:

int shsarray[10];

The array with the name shsarray will be created with size 10.


Initialization:

Initialization of the array can be done along with the declaration.

The index is the number by which we can access the elements of an array.

Index starts from 0 to (size of the array)-1

The array can be initialized in two ways 

1)At the time of the creation 

Example:

int shsarray[10]={1,2,3,4,5,56,7,8,8,5};

Or can also do without declaring the size of the array in this case like below example.

Int shsarray[]={1,2,3,4,5,5,6,67};

2)Individually using indices

int shsarray1[3];

shsarray[0]=34;

shsarray[1]=65;

shsarray[2]=66;


    34

    65

      66

      0                     1               2

Can be accessed by using the same indices like shsarray[1]

Will give output as 65.


Advantages of Using Arrays :

  • Can store and access data items with fewer lines of code

  • Can search for an element easily using indices.

  • Can perform sorting operation easily.


Disadvantages :

  • We can’t change the size of the array dynamically while running if we want to increase or decrease the size of the array because array size should be fixed, at the time of declaration.


Sample program-1:

Output:

1

4

6

8

Sample Program-2:

Output:

101

23

10

9

7

Note: To do in ascending order just change as a[j]<a[i]


Sample program 3:

Output:

Printing Largest element of the array…

10



2 Dimensional Array

  1. The two-dimensional array can be defined as an array of arrays. 
  2. The 2D array is organized as matrices which can be represented as the collection of rows and columns. 


Declaration:

Syntax:

data_type array_name[rows][columns];

Here we have to represent a number of rows and a number of columns in the representation.

Example:

Int twodarray[2][3];

Here a two-dimensional array of name twodarray of 2 rows and 3 columns has been created.


Initialization:

Initialization can be done in two ways same as in the 1D array

1)At the time of the creation 

Example:

int twoDarray[2][3]={{1,2,3},{4,5,56}};

If you initialize without declaring the size of the array, like in the 1D Array

this will not work with 2D arrays. We will have to define at least the second dimension of the array

example.

int twoDarray[][3]={{1,2,3},{4,5,56}};

2)Individually using indices

int twoDarray[2][3];

twoDarray[0][0]=56;

twoDarray[0][1]=2;

twoDarray[0][2]=5;

twoDarray[1][0]=1;

twoDarray[1][1]=15;

twoDarray[1][2]=4;


        00                01              02

      56

      2                  

    5

      1

    15

    4

      10                 11               12       

Can be accessed by using the indices like twoDarray[1][0];

Will give output as 1.


Sample Program 1:

Input:

A[0][0]: 12

A[0][1]: 23

A[1][0]: 34

A[1][1]: 45

Output:

12    23

34    45




Note: More examples will be covered in Problems on C page

Arrays using structures and Arrays using pointers will be covered in the structures and pointers concept respectively

Similarly you can also learn the structures, unions and pointers concept in C programming Language.

If you have any doubts or you want us to create some more concepts or if you can't solve any problems please give it in the form of your comments.


If you like the content we had given and understood it well then give your valuable rating for this page and comment your experience in the comment Box .







  • Before going to start pointers. Let’s recall the concepts of variables, Variable is a memory location and every memory location has an address that can be accesses through the ampersand(&) operator.
  • Let us consider an example for a clear understanding of variables and their addresses.

    Program:

   Output:


Pointers:

A pointer is a variable that stores the address of another variable. To use the function of pointers in C language we must understand the two unary operators
  1. Unary operator &(ampersand) to returns the address of that variable
  1.  Unary operator *(asterisk) is used for two things-Used to declare the pointer variable and used to access the value stored in the variable

Declaration of pointer:

Type *var_name;
Here type is pointers base type i.e it must be valid c data type and var_name is the name of the pointer variable. *(Asterisk) is used to declare the pointer variable. Here is some of the various pointer variable declarations
int *ip;
double *dp;
float *fp;
char *cp;
There are mainly three steps involved to use the pointers effectively
  1. Declare the pointer variable
  2. Assign the address of the variable to a pointer variable
  3. Access the value

Sample Program:


Output:


Pointers to array:-

int shsArray[10];
int *ptr = &shsArray;

In the below example array pointer ptr stores the address of the shsArray

Example :

Output :



Null Pointer:-

  • If the pointer is declared as NULL then it is called a null pointer. If the programmer has no value of pointer at the time of declaration then the pointer is assigned by a NULL value. It gives a better approach to solve problems.
Program :


Output :


Advantages of the pointers:-
  • Pointers reduce the code.
  • Pointers increase the performance of the code.
  • Pointers are used in arrays, structures, and functions.
  • Pointers are used to return the multiple values from the functions.
  • Dynamic memory allocation is possible in pointers using malloc() and calloc() functions.

Here is an example to clearly understand the working of the pointers in a c programming language. The problem statement is swapping of the two numbers using pointers

Program :


Output :



Note: More examples will be covered in Problems on C page
Similarly you can also learn the structures, arrays and unions concepts in C programming Language.

If you have any doubts or you want us to create some more concepts or if you can't solve any problems please give it in the form of your comments.


If you like the content we had given and understood it well then give your valuable rating for this page and comment your experience in the comment Box for improvement.