Exforsys.com
 
Home Tutorials C Language
 

C Programming - Arrays

 

C Programming - Arrays

In this tutorial you will learn about C Programming - Arrays - Declaration of arrays, Initialization of arrays, Multi dimensional Arrays, Elements of multi dimension arrays and Initialization of multidimensional arrays.


The C language provides a capability that enables the user to define a set of ordered data items known as an array.


Suppose we had a set of grades that we wished to read into the computer and suppose we wished to perform some operations on these grades, we will quickly realize that we cannot perform such an operation until each and every grade has been entered since it would be quite a tedious task to declare each and every student grade as a variable especially since there may be a very large number.


In C we can define variable called grades, which represents not a single value of grade but a entire set of grades. Each element of the set can then be referenced by means of a number called as index number or subscript.


Declaration of arrays:

Like any other variable arrays must be declared before they are used. The general form of declaration is:


type variable-name[50];


The type specifies the type of the elements that will be contained in the array, such as int float or char and the size indicates the maximum number of elements that can be stored inside the array for ex:


float height[50];


Declares the height to be an array containing 50 real elements. Any subscripts 0 to 49 are valid. In C the array elements index or subscript begins with number zero. So height [0] refers to the first element of the array. (For this reason, it is easier to think of it as referring to element number zero, rather than as referring to the first element).


As individual array element can be used anywhere that a normal variable with a statement such as


G = grade [50];


The statement assigns the value stored in the 50th index of the array to the variable g.
More generally if I is declared to be an integer variable, then the statement g=grades [I];
Will take the value contained in the element number I of the grades array to assign it to g. so if I were equal to 7 when the above statement is executed, then the value of grades [7] would get assigned to g.


A value stored into an element in the array simply by specifying the array element on the left hand side of the equals sign. In the statement


grades [100]=95;


The value 95 is stored into the element number 100 of the grades array.
The ability to represent a collection of related data items by a single array enables us to develop concise and efficient programs. For example we can very easily sequence through the elements in the array by varying the value of the variable that is used as a subscript into the array. So the for loop


for(i=0;i < 100;++i);
sum = sum + grades [i];


Will sequence through the first 100 elements of the array grades (elements 0 to 99) and will add the values of each grade into sum. When the for loop is finished, the variable sum will then contain the total of first 100 values of the grades array (Assuming sum were set to zero before the loop was entered)


In addition to integer constants, integer valued expressions can also be inside the brackets to reference a particular element of the array. So if low and high were defined as integer variables, then the statement


next_value=sorted_data[(low+high)/2]; would assign to the variable next_value indexed by evaluating the expression (low+high)/2. If low is equal to 1 and high were equal to 9, then the value of sorted_data[5] would be assigned to the next_value and if low were equal to 1 and high were equal to 10 then the value of sorted_data[5] would also be referenced.


Just as variables arrays must also be declared before they are used. The declaration of an array involves the type of the element that will be contained in the array such as int, float, char as well as maximum number of elements that will be stored inside the array. The C system needs this latter information in order to determine how much memory space to reserve for the particular array.


The declaration int values[10]; would reserve enough space for an array called values that could hold up to 10 integers. Refer to the below given picture to conceptualize the reserved storage space.


values[0]



values[1]



values[2]



values[3]



values[4]



values[5]



values[6]



values[7]



values[8]



values[9]


 



The array values stored in the memory.


Initialization of arrays:

We can initialize the elements in the array in the same way as the ordinary variables when they are declared. The general form of initialization off arrays is:


type array_name[size]={list of values};


The values in the list care separated by commas, for example the statement


int number[3]={0,0,0};


Will declare the array size as a array of size 3 and will assign zero to each element if the number of values in the list is less than the number of elements, then only that many elements are initialized. The remaining elements will be set to zero automatically.


In the declaration of an array the size may be omitted, in such cases the compiler allocates enough space for all initialized elements. For example the statement


int counter[]={1,1,1,1};


Will declare the array to contain four elements with initial values 1. this approach works fine as long as we initialize every element in the array.


The initialization of arrays in c suffers two draw backs
1. There is no convenient way to initialize only selected elements.
2. There is no shortcut method to initialize large number of elements.


/* Program to count the no of positive and negative numbers*/
#include< stdio.h >
void main( )
{
int a[50],n,count_neg=0,count_pos=0,I;
printf(“Enter the size of the array\n”);
scanf(“%d”,&n);
printf(“Enter the elements of the array\n”);
for I=0;I < n;I++)
scanf(“%d”,&a[I]);
for(I=0;I < n;I++)
{
if(a[I] < 0)
count_neg++;
else
count_pos++;
}
printf(“There are %d negative numbers in the array\n”,count_neg);
printf(“There are %d positive numbers in the array\n”,count_pos);
}


Multi dimensional Arrays:

Often there is a need to store and manipulate two dimensional data structure such as matrices & tables. Here the array has two subscripts. One subscript denotes the row & the other the column.
The declaration of two dimension arrays is as follows:


data_type array_name[row_size][column_size];
int m[10][20]


Here m is declared as a matrix having 10 rows( numbered from 0 to 9) and 20 columns(numbered 0 through 19). The first element of the matrix is m[0][0] and the last row last column is m[9][19]


Elements of multi dimension arrays:

A 2 dimensional array marks [4][3] is shown below figure. The first element is given by marks [0][0] contains 35.5 & second element is marks [0][1] and contains 40.5 and so on.


marks [0][0]
35.5


Marks [0][1]
40.5


Marks [0][2]
45.5


marks [1][0]
50.5


Marks [1][1]
55.5


Marks [1][2]
60.5


marks [2][0]


Marks [2][1]


Marks [2][2]


marks [3][0]


Marks [3][1]


Marks [3][2]



Initialization of multidimensional arrays:

Like the one dimension arrays, 2 dimension arrays may be initialized by following their declaration with a list of initial values enclosed in braces


Example:


int table[2][3]={0,0,01,1,1};


Initializes the elements of first row to zero and second row to 1. The initialization is done row by row. The above statement can be equivalently written as


int table[2][3]={{0,0,0},{1,1,1}}



By surrounding the elements of each row by braces.
C allows arrays of three or more dimensions. The compiler determines the maximum number of dimension. The general form of a multidimensional array declaration is:


date_type array_name[s1][s2][s3]…..[sn];


Where s is the size of the ith dimension. Some examples are:


int survey[3][5][12];
float table[5][4][5][3];


Survey is a 3 dimensional array declared to contain 180 integer elements. Similarly table is a four dimensional array containing 300 elements of floating point type.


/* example program to add two matrices & store the results in the 3rd matrix */
#include< stdio.h >
#include< conio.h >
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,m,n,p,q;
clrscr();
printf(“enter the order of the matrix\n”);
scanf(“%d%d”,&p,&q);
if(m==p && n==q)
{
printf(“matrix can be added\n”);
printf(“enter the elements of the matrix a”);
for(i=0;i < m;i++)
for(j=0;j < n;j++)
scanf(“%d”,&a[i][j]);
printf(“enter the elements of the matrix b”);
for(i=0;i < p;i++)
for(j=0;j < q;j++)
scanf(“%d”,&b[i][j]);
printf(“the sum of the matrix a and b is”);
for(i=0;i < m;i++)
for(j=0;j < n;j++)
c[i][j]=a[i][j]+b[i][j];
for(i=0;i < m;i++)
{
for(j=0;j < n;j++)
printf(“%d\t”,&a[i][j]);
printf(“\n”);
}
}



Read Next: C Programming - Handling of character string



 

 

Comments


manicks said:

  /* example program to add two matrices & store the results in the 3rd matrix */
#include
#include
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,m,n,p,q;
clrscr();
printf(“enter the order of the matrix\n”);
scanf(“%d%d”,&p,&q);
if(m==p && n==q)
{
printf(“matrix can be added\n”);
printf(“enter the elements of the matrix a”);
for(i=0;i [i][j] b[i][j];
for(i=0;i j )
printf(“%d\t”,&a[i][j]);
printf(“\n”);
}
}
December 18, 2006, 4:24 am

Mays said:

  int table[2][3]={0,0,01,1,1}; :: Here is a typo:: CORRET: int table[2][3]={0,0,0,1,1,1}; --comma missing

May 22, 2007, 10:22 am

abhijeet said:

  Hi can u plz help me out to write a program for the mul;tipication of twp matrixes.
July 22, 2007, 9:39 pm

Rover said:

  Create a program that will compute for the sum of all odd numbers between 0 to 10. Store the values in a array and compute for the sum of all the odd numbers by looping through each element in the array.
September 13, 2007, 8:19 pm

frozed said:

  give me a program in c that would count the number of similar inputs and display it in descending order.
September 20, 2007, 11:48 pm

Thilak11 said:

  give me a program in c for matrix multiplication
October 12, 2007, 6:06 am

lohumi said:

  hi buddy i tried the above programe bt got sme problem
there should nt be
printf(“%dt”,&a[i][j]);
but it is
printf(“%dt”,c[i][j]);

thanx
October 18, 2007, 1:26 am

sshhhhh said:

  can u please give a program that would give the time of the program when it was lastly accessed. also please tell how to compare the time of two programs
October 24, 2007, 4:21 am

adil said:

  write a programe to add two matrices
October 31, 2007, 3:40 am

blue said:

  Hi can u plz write a program to define an array, ask the user to assign values and check if an element is present in the array and its position in it?
November 22, 2007, 10:02 am

fishy said:

  can u help write a program which finds whether a number is palindromic prime or not?
November 29, 2007, 9:06 am

John Pitmen said:

  I was wondering how would you go about writing an Array program that allows the user to input a string of data for a 3 x 3 table. Calculates the sum or each row and column, outputs the array, sum of rows and columns and than calculated the diagonal sum of the table, corner to corner.
November 29, 2007, 11:14 am

ashley racusa said:

  can u help me write a program which u wil enter name and the vowels wil become asterisk... please help me...
December 5, 2007, 7:16 pm

lorena said:

  can u teach me how to write a program that will insert a value on an array between two indexes? for example..I will insert the value 23 between index 1 and index 2...and the value on those indexes will not be replaced...how?
December 9, 2007, 9:13 am

Ned Hershell said:

  how can i create an m,x,n array that will find the sum of diagonal elements.. thanks
December 12, 2007, 12:59 am

teen said:

  can we use heterogeneous declarations in arrays? if they are not declared what is the reason
February 25, 2008, 10:53 am

girly said:

  can u please give me some examples of multidimensional array with using functions?
February 28, 2008, 10:45 pm

tarini said:

  Hi can u plz help me out to write a program for the mul;tipication of twp matrixes.
April 11, 2008, 1:50 am

FRANCHESKA said:

  can u pls give me a prog with combination of function,looping,recursion,and array...i nid it asap...tnx u xo mch...
May 7, 2008, 6:33 am

riswan said:

  In the initialization arrays part example there is a open bracket missing in the first for statement please mention about that thank you.
June 4, 2008, 3:54 am

sri vidya said:

  write a program for checking a symmetric matrix
June 25, 2008, 1:03 am

shashank shekhar said:

  pls help me application of one dimensional and two dimensional arreys.
July 8, 2008, 3:24 am

rainy_shadow said:

  plz help me to solve the following problems as soon as possible:
(1) Input n numbers and find the summation of the digits of the prime numbers among those n numbers.?
(2) Input some students age & CGPA in two different arrays .Display the age of the highest CGPA students from those array?
(3)Input n numbers and find how many numbers are greater than the 1st number,how many numbers are greater than the 2nd number and how many numbers are greater than the 3rd number.?


now please please please give some hints or give a full solve those questions to help me.If u do so i will be ever greatful to u.
July 9, 2008, 2:31 am

program writing said:

  given
int x[3][3]={{5,2,4},{7,8,6},{10,12,11}};
assist me to write a program quickly that would display the smallest value in the array








July 17, 2008, 6:17 am

brook said:

  can you give an example on how to get the highest value in the array
and the index where it is being pu....
July 31, 2008, 6:32 am

chyrre said:

  what will be the code if I would create an array,the size is 25.Initialized the first ten elements and display it without the array list.Then delete an element and display again the list....thank you!! it's so easy dvahh??
so answer now!! if you can answer this quickly then you'll might be the most genius in the field of programming!!
August 1, 2008, 5:34 am

Danniel roger said:

  Iam a professor in the cologe " William France Univesity" in France iam now in malasia i want some more information in ARRAYS IN C LANGUAGE as i want to know . Basically iam a science professor and also wants to become a good computer professor
August 19, 2008, 9:57 am

sirija said:

  can u write a program for checking whether a given number is prime number or not
October 20, 2008, 12:40 am

rahul singh said:

  hi this is rahul i am very satisfify for this programe and i would like in fiuture everybody will help me


thankyou thankyou very much
October 21, 2008, 6:56 am

sreejith said:

  can we define an array with dynamic size?
November 1, 2008, 8:54 am

juhi said:

  Can u write a program to sort a list of numbers and to determine the median of the number....(the size of the array shud b input by the user i knw the whole prog but i actually dont knw hw the user can input the size of the array )hope u got my question!
November 1, 2008, 2:34 pm

sam said:

  hi, plz tell me, why we start array index from 0, not 1
November 12, 2008, 7:51 am

Arindam said:

  can you help me solve this problem.
Q. to find the sum of individuals rows & column 5/5 matrix
November 14, 2008, 8:46 am

Piku said:

  Hi!
How to disply this partern
12345
6789
123
45
6
November 14, 2008, 8:50 am

santu dhara said:

  2 d array sorting using c
November 15, 2008, 3:29 am

John Stuffer said:

  Sam: Think it as an offset from the base of the array. You can address an item in array this way: array[n] or this way: *(array+n). It's equivalent, so if you used n=1, you'd be working with the fist item after the base of array - the array's second item.
November 15, 2008, 12:41 pm

priyanka said:

  its nice
November 24, 2008, 4:53 am

vivek pratap said:

  its so good & nice
November 27, 2008, 8:52 am

avishan said:

  please help me to create a program that calculates and stores 10 random numbers between 1 and 100.output the random numbers to the screen using a loop and then output them again in reverse using a second loop.thnx
December 2, 2008, 9:55 am

Gnanadesikan said:

  using array concepts,How to display the month when we enter the number of month?

I need it soon.
please....
December 2, 2008, 9:59 am

umang said:

  program of ohm
* * * * * *
* * *
* * * *
* * * * * * * * *
* *
* *
* * * * * * * *
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n,s=21;
clrscr();
textcolor(500);
printf("enter the value of n:");
scanf("%d",&n);

for(i=1;i<=n;i++)
{
for(k=1;k<s;k++)
printf(" ");

for(j=1;j<=n;j++)
{
if(i==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==1 || i==n ||j==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==n)
cprintf("*");
else
printf(" ");
}

printf(" ");
for(j=1;j<=n;j++)
{
if(j==1 || i==n)
cprintf("*");
else if(i==(n+1)/2 && j==(n+1)/2)
printf("*");
else
printf(" ");
}
s=s-0;
printf("n");
}

for(i=1;i<=n;i++)
{
for(k=1;k<s;k++)
printf(" ");

for(j=1;j<=n;j++)
{
if(j==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==n ||j==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
printf(" ");
}
for(j=1;j<=n;j++)
{
if(j==1 || i==n)
cprintf("*");
else
printf(" ");
}
s=s-0;
printf("n");
}
getch();
}
December 2, 2008, 11:18 pm

umang said:

  program of ohm
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n,s=21;
clrscr();
textcolor(500);
printf("enter the value of n:");
scanf("%d",&n);

for(i=1;i<=n;i++)
{
for(k=1;k<s;k++)
printf(" ");

for(j=1;j<=n;j++)
{
if(i==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==1 || i==n ||j==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==n)
cprintf("*");
else
printf(" ");
}

printf(" ");
for(j=1;j<=n;j++)
{
if(j==1 || i==n)
cprintf("*");
else if(i==(n+1)/2 && j==(n+1)/2)
printf("*");
else
printf(" ");
}
s=s-0;
printf("n");
}

for(i=1;i<=n;i++)
{
for(k=1;k<s;k++)
printf(" ");

for(j=1;j<=n;j++)
{
if(j==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==n ||j==n)
cprintf("*");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
printf(" ");
}
for(j=1;j<=n;j++)
{
if(j==1 || i==n)
cprintf("*");
else
printf(" ");
}
s=s-0;
printf("n");
}
getch();
}
December 2, 2008, 11:31 pm

umang said:

  how can i print series
0,1,1,2,3,5,8,........
please give me solution on below Email I'd.
umangp81@gmail.com
December 2, 2008, 11:36 pm

1 said:

  i want program for interchange biggest & second biggest position in c using arrays.....
urgent plz
December 9, 2008, 8:53 am

Elmer Fernandes said:

  i want a C program to find the sum of the diagonal elements of a matrix using arrays.
December 11, 2008, 1:56 pm

Mussa William said:

  It's very nice!
December 17, 2008, 7:39 am

wapang said:

  i want a program that uses arrays in its most simplest form but does a lot of tasks.
December 19, 2008, 3:02 am

viswanadh said:

  hi this is viswanadh.it's very nice
December 22, 2008, 12:47 am

1 said:

  Hi, This is Habeeb, Hyderabad INDIA. I am basically Graphics and Web Designer. Can you give me more information arrays

Habeeb
December 25, 2008, 3:51 am

jitendra kumar prajapati said:

  tell me how can i create a c program to print armstrong number.please inform me on

c_jk@rediffmail.com
December 27, 2008, 6:56 am

elangovan said:

  how to initialize a three dimensional array and an example to pointer to a 2 dimensional array
January 1, 2009, 12:59 pm

renu said:

  I wants the program for addition of two matrix in c-language
January 5, 2009, 12:04 pm

samhitha said:

  please give me c program for finding largest and smallest value in a matrix
January 6, 2009, 10:53 am

DILIP said:

  write a programme to check whether the matrix is diagnal or not
January 8, 2009, 1:07 am

DILIP said:

  please give me c program for finding biggest and smallest elements in a array

urgent pls.
January 8, 2009, 1:19 am

rocky said:

  hello....i am rocky. can you help me.? I have a problem about program.... program to sort the element of the matrix.
January 13, 2009, 12:45 am

ashish said:

  hallo plz help me in data stracture and How can creait an logic in mind for c programs in C laguage...
January 18, 2009, 9:59 am

aashrita said:

  can u give me how to write a to copy one string to another string
January 21, 2009, 5:40 am

Jasveer khachi said:

  please give me a program to find the greatest value among three given values with nested_if without using operators...
January 21, 2009, 11:54 am

ravi paul said:

  i want to generate bar code using c language
please give example program with explanation
January 27, 2009, 3:43 am

niranjan said:

  it is very nice
January 28, 2009, 7:44 am

Ali Ahmad said:

  write a c program to find the sum of all prime numbers in an array? if any one can help me to do this question
February 3, 2009, 8:27 am

xxx said:

  i need RECURSIVE c program to reverse input number.
also i need algorithm for selection sort and implementing the same.
also i need algorithm and program for finding ITERATIVE factorial.
February 3, 2009, 11:28 pm

Khushbu said:

  Can u please tell me the advantages and disadvantages of using arrays
February 5, 2009, 10:15 am

sanjay said:

  hi
I want programme to accept n numbers in range 1to 25 and count the frequency of occurence of each number.
February 6, 2009, 7:07 am

aneem said:

  can u plz explain how to do a programme for multiplication of sparse matrices?
February 7, 2009, 1:54 am

pragya said:

  #include<stdio.h>

void main()
{
int m,i,j;
printf("enter d no of rows");
scanf("%d",&m);
int a[m][m];
printf("fill d first matrixn");

for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
scanf("%d",&a[i][j]);

}
printf("n");

}

for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
printf("%d",a[i][j]);
printf(" ");
}
printf("n");
}

}
February 8, 2009, 1:48 am

1 said:

  Please show me how to write a program involving elements of main diagonal of matrix and find their sum and matrix involving elements of upper diagonal and their sum.
February 9, 2009, 11:25 am

anoosha said:

  In what way array is different from an ordinary variable
February 13, 2009, 10:52 pm

Anoosha said:

  this is program to find the largest and smallest number in arrays
#include<stdio.h>
void main()
{
int a[20];
int i,n,max,min;
print f("enter no of elements:");
scan f("%d",&n);
print f("reading array elements:");
for(i=0;i<n;i++)
{
print f("enter a[%d]elements:");
scan f("%d",&a[i]);
}
print f("array elements:");
for(i=0;i<n;i++)
{
print f("%dt",a[i]);
}
max=a[0];
min=a[0];
for(i=0;i<n;i++)
{
if(max<a[i])
{
max=a[i];
}
if(min>a[i])
{
min=a[i];
}
}
print f("n max=%dt min=%d",max,min);
}
February 13, 2009, 11:14 pm

Croco said:

  Hey,
Lets say I have 2 tables of data:
table1: 5,2,5,7
table2: 7,1.5,6,4
How can I write a C prog. that outputs the lowest number and from which table?
Thanks.
February 16, 2009, 11:48 pm

greenie said:

  How to write a 'C' program to read an array of 10 numbers and print the prime nums?
this is what i wrote
could someone tell me where is my mistake?
can i use here flag at all?

#include <stdio.h>

void main ()
{
int arr[10], i, j, flag;

for (i=0;i<10;i++)

scanf ("%d", &arr[i]);

for (i=0;i<10;i++)
{
flag=1;


for (j=2;j<=(arr[i]/2); j++)
{
if (arr[i]%j==0)
{
flag=0;
break;

}
}
}

for (i=0;i<10;i++)
{
if (flag=1)

printf ("%d", arr[i]);
}
}
February 20, 2009, 11:26 am

Ravi said:

  Write a function int isit ( int mat[][], int n) to return TRUE if the n x n array mat is left upper triangular matrix or a right lower triangular matrix, and FALSE otherwise. The array should be read in the main function. An array is left upper triangular if all the elements below the right-to-left diagonal elements are zero. Similarly, in a right lower triangular array, all the elements above the right-to-left diagonal are zero.
February 23, 2009, 11:51 am

tesfito group said:

  please help us in doing the following lab assessment


Write a program that reads in an integer and prints out the given integer in binary, octal and hexadecimal formats.

your program should do the following tasks:

* it should accept an integer number from the keyboard
* change this number to binary, octal and hexadecimal formats
* it should finally print these three formats to the screen
April 10, 2009, 2:40 am

Chi said:

  I'm new to C programming and i'm a bit confused about how to scan numbers into an array from a format such as this:

1 2 3
4 5 6
7 8 9

i understand how to write a program to print that array however it's when i have to ask the user to input their own numbers in that form that i don't know how to scan it and then print it.

Any help would be great
April 15, 2009, 8:57 am

kcmen said:

  Need help with writing a program that: Lets Arr be an array of 20 integers. The program should first fill the array with up to 20 input values and then find and display both the subscript of the largest item in arr and the value of the largest item.
April 15, 2009, 4:56 pm

Mohini sharma said:

  void main()
{
in a[1],i;
for(i=0;i<=9;i++)
scanf("%d",&a[i]);
for(i=0;i<=9;i++)
printf("%d",a[i]);
getch();
}
how can we store 10 elements in one element size array then what is use of array.without giving 10 size we are able to store 10 elemetns.
May 12, 2009, 1:24 am

madiha001 said:

  can u plz help me out to write a program in which user inputs a name and a password match it with some stored names and passwords in a variable and if it matches print "welcome to my program" using arrays
May 12, 2009, 11:41 am

Ritchel said:

  How can I print the length of the string, the number of spaces and special character? Please help me.
July 1, 2009, 1:59 am

jitendra said:

  can array be defined as float a[2.5][2.5],so that at various positions such as a[1][1.5] a[1.5][1.5] a[2][1.5] a[2.5][2.5] values can be stored?
August 29, 2009, 7:51 am

cheese said:

  can u help me to write a complete C program to perform Matrix operation such as Addition,Subtraction,Multiplication and Transpose according to the user's choice.Define functions to perform these various operations and call them from the main function whenever needed.The program should display the following menu to the user for them to select one of the five options listed.
MAIN MENU
1. MATRIX ADD.
2. MATRIX SUB.
3. MATRIX MULTI.
4. MATRIX TRANSPOSE
5. EXIT
this program is an infinte loop and it will return if enter wrong number.
thak you.
September 7, 2009, 11:58 am

kamal ahmad siddiqui said:

  //progam factorial of givan pogistion....
#include<conio.h>
#include<stdio.h>
void main()
{
int n=0,f=1:
printf("n enter the any no");
scanf("%d",&n);
while(n>=1)
{
f=f*n;
printf("*%d",n);
n--;
}
printf("%d",f);
getch();
}
September 19, 2009, 5:43 am

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification:
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape