Goeduhub:- AI, ML, HADOOP, Python and IOT Training provider.
Register for Free Certified Workshop on AI & Machine Learning :: 26-01-2020 || Career options for aspiring CS/IT, ECE, EE or EIC or EEE Engineers
0 like 0 dislike
10 views
in Tutorial & Interview questions by (6.7k points)

 Define array and access array element

1 Answer

0 like 0 dislike
by (6.7k points)
 
Best answer
#include <stdio.h>

#define ARRLEN (10)

int main (void)

{

int n[ ARRLEN ]; /* n is an array of 10 integers */   

size_t i, j; /* Use size_t to address memory, that is to index arrays, as its guaranteed to                   be wide enough to address all of the possible available memory. Using signed integers to do so should be considered a special use case, and should be restricted to the uncommon case of being in the need of  negative indexes. */

   /* Initialize elements of array n. */           

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

{      

n[ i ] = i + 100; /* Set element at location i to i + 100. */   

}      /* Output each array element's value. */   

for (j = 0; j < ARRLEN ; j++ )   

{      

printf("Element[%zu] = %d\n", j, n[j] );   

}

   return 0;

}

|| New Year Discount on summer training-2020 ||

20% OFF | on all summer training courses

|| Offer valid till 31-JAN-2020 (Extended Date) ||

Courses & Fee

  1. Augmented Reality & Virtual Reality - INR 15000/-
  2. AI, ML & Deep Learning - INR 12000/-
  3. Robotic Process Automation (RPA) - INR 12000/-
  4. Big Data HADOOP - INR 12,000/-
  5. Internet of Things (IoT) - INR 10,000/-
  6. Web development using python (Django) - INR 8000/-
  7. Industrial Automation (PLC-SCADA) - INR 8000/- 

Limited time offer !! Hurry up!!

[[ CALL - 07976731765 ]]

Register for Training

 Go to your Branch CSE or IT | ECE | EE, EIC or EEEMECE
 Know About Popular Colleges/Universities  List of IITsList of NITs | RTU-KOTA | Manipal University-Jaipur | JECRC University | Amity University Jaipur | BIT Mesra-Jaipur | MODY UNIVERSITY | LNMIIT-Jaipur | JK Lakshmipat | Banasthali Vidyapith | POORNIMA University
 Exams:   List of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG) | JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs
Placements:  List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Online Free Training:  Artificial Intelligence(AI) & Machine Learning | Python Programming | Internet of Things-IoT | OpenCV (Open Source Computer Vision Library) | LINUX | Big Data : Hadoop | 
 Goeduhub
About Us | Contact Us   Social::   |  | 
...