UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Is it valid to address one element beyond the end of an array?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

C Language Trainer

No, array is a fixed size memory allocation for variables. It is illegal to access elements beyond the allocated space.
Comments

Thank You for the question Shivani, No for an array you cannot go beyond the size of an array. Thanks, Team DishaaPro www.dishaapro.com
Comments

Computer & Maths Professor

Yes. We can refer to an element beyond array size as C follows the following formula to go to a specific element in an array- starting address of array + sizeof(datatype of array)*subscript of array used. For example, if there is an int (assuming 2 bytes storage space for int) array of size 5 starting...
read more
Yes. We can refer to an element beyond array size as C follows the following formula to go to a specific element in an array- starting address of array + sizeof(datatype of array)*subscript of array used. For example, if there is an int (assuming 2 bytes storage space for int) array of size 5 starting from address say, 100 and the user tries to access a[5], C compiler would move to 100+2*5 i.e. address 110 irrespective of the subscript number as array elements are stored continuously in memory. read less
Comments

COMPUTER GEEK

No for an array you can not go beyond the size of array as you may be entering into restricted area and may result in segmentation fault. Only C99 allows to have the size of address at runtime
Comments

C and linux Expert

It's valid to address it, but not to see what's there.
Comments

LearnHowToLearn, Expert In Programming Languages

No. It is invalid even if there won't be any compilation error. Accessing elements beyond array size is illegal memory access may cause segmentation fault runtime.
Comments

Not a great idea, you will be accessing memory which doesn't belong to you or your array, may be used by some other variable with some other meaning/view.
Comments

VKTechnology

no. outof bound array exception occurs
Comments

website and mobile application development training, digital marketing training

No
Comments

GeeksForGeeks

C language do not perform any bounds check on array during run time, so it will not give any error if you are doing so. But technically its not right to do so, because the memory location you are using or manipulating anything may contain some very sensitive information, which may other program are...
read more
C language do not perform any bounds check on array during run time, so it will not give any error if you are doing so. But technically its not right to do so, because the memory location you are using or manipulating anything may contain some very sensitive information, which may other program are using, can lead to crash the program or machine itself.. read less
Comments

View 18 more Answers

Related Questions

Why is C still so popular?
While other languages have come and gone, C has remained a popular choice for many developers. One reason for C's continued popularity is its versatility, and it can be used for a wide range of tasks,...
Chitra
0 0
5
What is the best IDE for C and C++ development?
If you're a student then Turbo C++ is best for C and C++ program + inbuilt C/C++ Graphics Function If you're a professional or working then Netbeans for C/C++ or Code:: Blocks is Best.
Balakrishnasingh
How do I write code in C programming that will invert a string like "Welcome to programming" to “gnimmargorp ot emocleW”?
void main() { char msg = "Welcome to Programming"; char str; int i = 0, j = 0; clrscr(); while (msg != '\0') { if (msg != ' ') { str = msg; j++; ...
Mukul
What is a local block in C programming?
the statements within the braces { } is known as local block
Rakhi
0 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Design your own Mouse Driver in C Language
Mouse Driver (msdrv.h) #include #include union REGS i,o; restrictmouseptr(int x1, int y1, int x2, int y2) { i.x.ax=7; i.x.cx=x1; i.x.dx=x2; ...

C Programming basics
C PROGRAMMING BASICS 10 Hours Introduction to ‘ C’ programming –fundamentals – structure of a ‘C’...
O

Om K.

0 0
0

Why do pointers have a datatype?
Before we start with pointers you must know what is a variable and a datatype. int a; This is the basic line in every program in 'C' . It means that we are asking the compiler to give us 2 bytes of space...

C Program-Error Handling[Program Exit Status]
//Header files #include<stdio.h>#include<conio.h>#include<stdlib.h> //Main Function void main(){ int dividend=20; int divisor=5; int quotient; //Function for clearing screen clrscr();...
S

C-Program Swapping Contents Of Variables Using Function [Call By Reference Method]
//Header Files #include#include // User defined functions swap with 2 pointer variables passed as an argument list void swap(int*i,int*j){ // Local variable temp int temp; // swapping contents using...
S

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more