#include <stdio.h>
void main(void) {
// Setup Our Varible
int a[7]; // this is how to declare 7 integer variable array
// SET VALUE
int b[] = { 0 , 1, 2 , 3, 4 , 5, 6 };
// IF WE DECLARE THE FIRST WAY WE NEED TO ASSIGN IT MANUALLY LIKE THIS ... .
a[0] = 1; // ARRAY ALWAYS BEGIN FROM 0 ... .
a[1] = 2;
a[2] = 3;
a[3] = 4;
a[4] = 5;
a[5] = 6;
a[6] = 7;
printf("value of a[0] %d , address of a[0] %d\n", a[0], &a[0]);
printf("value of b[0] %d , address of b[0] %d", b[0], &b[0]);
}
HEAR SAMPLE OF CODE ON TOP … .
#include <stdio.h>
void main(void) {
// Setup Our Varible
int a[7]; // this is how to declare 7 integer variable array
// SET VALUE
int b[] = { 0 , 1, 2 , 3, 4 , 5, 6 };
// IF WE DECLARE THE FIRST WAY WE NEED TO ASSIGN IT MANUALLY LIKE THIS ... .
a[0] = 1; // ARRAY ALWAYS BEGIN FROM 0 ... .
a[1] = 2;
a[2] = 3;
a[3] = 4;
a[4] = 5;
a[5] = 6;
a[6] = 7;
printf("value of a[0] %d , address of a[0] %d\n", a[0], &a[0]);
printf("value of b[0] %d , address of b[0] %d", b[0], &b[0]);
// IF WE WANT TO PRINT THE WHOLE ARRAY WE INTRODUCE LOOP TO YOU ALL NOW FIRST IS WHILE SECOND IS FOR
// WHILE LOOP FIRST
int i;
i = 0; // We set i = 0
while (a[i] != 6) {
printf("\nvalue at a[%d] is %d\n", i, a[i]); // DONT BE ALARM AS A[I] IS BEEN CALLING THE SAME LIKE PRINTF
// BUT WE NEED TO INCREMENT THE VALUE OF I
// SO THE VALUE OF I CAN KEEP ON ROUND TILL IT HIT 6
// TO HIT != MEAN EQUAL WITH THE LEFT VALUE
// LOWER MEAN <
// GREATER MEAN >
i++; // We increment i++; which is mean it is the same as i = i + 1;
}
i = 0;
while (a[i] <= 6) { // another example lesser and equal to 6
printf("\nvalue at a[%d] is %d\n", i, a[i]); // the same value
i = i + 1; // THE SAME AS i++;
}
}
FOR LOOP NEXT IN PART 9 ... .
![]()