Professional Documents
Culture Documents
An array is a variable that can store multiple values. For example, if you want to store 100
integers, you can create an array for it.
#include <stdio.h>
#include<conio.h>
void main()
{
int marks[10], i, n, sum = 0, average;
sum += marks[i];
}
average = sum/n;
printf("Average = %d", average);
getch();
}
Output
Enter n: 5
Enter number1: 45
Enter number2: 35
Enter number3: 38
Enter number4: 31
Enter number5: 49
Average = 39
String
#include <stdio.h>
#include<conio.h>
void main()
{
char s[10];
int count = 0;
printf("Input a string\n");
gets(s);
getch();
}
output
Computer
Length of string 8
Pointer
C Pointers
Pointers (pointer variables) are special variables that are used to store addresses rather than
values.
int* p;
#include <stdio.h>
#include<conio.h>
void main () {
int var1;
char var2[10];
getch();
}
Output
Address of var1 variable: bff5a400
Address of var2 variable: bff5a3f6